当通过 --tags 获取 git refs 时,“upload-pack: not our ref”是什么意思?

2023-12-26

在我的一个项目中,一旦我的构建脚本尝试使用以下命令获取所有 Git 标签,Travis 构建就会在到达我的任何构建系统或代码之前失败:git fetch --tags:

`` git fetch --tags --verbose
POST git-upload-pack (350 bytes)
POST git-upload-pack (788 bytes)
POST git-upload-pack (797 bytes)
From https://github.com/ELLIOTTCABLE/bs-sedlex
 = [up to date]      fix-ci        -> origin/fix-ci
 * [new tag]         sedlex-1.99.2 -> sedlex-1.99.2
 * [new tag]         v1.99.3       -> v1.99.3
...
 * [new tag]         v20.0.0-pre.2 -> v20.0.0-pre.2
Fetching submodule ppx-sedlex
POST git-upload-pack (122 bytes)
From https://github.com/ELLIOTTCABLE/ppx-sedlex
 = [up to date]      develop       -> origin/develop
 = [up to date]      master        -> origin/master
...
 = [up to date]      v20.0.0-pre.2 -> v20.0.0-pre.2
POST git-upload-pack (4 bytes)
POST git-upload-pack (69 bytes)
POST git-upload-pack (586 bytes)
fatal: remote error: upload-pack: not our ref 0f509703fcd43ff4324d721a39220153bab49d4a

这尤其令人困惑,因为主要仓库都没有bs-sedlex,也不是 git-submoduleppx-sedlex,有任何提交像这样开始0f5097...;我不知道 SHA 是从哪里来的。此故障仅发生在Linux工人,我不明白为什么——git fetch --tags在同一个存储库上,可以在 macOS Travis-workers、我的 macOS 机器上以及我启动的 Ubuntu Vagrant 盒子上进行调试。

“致命:远程错误:上传包:不是我们的参考”错误意味着什么;我该如何解决这个问题?我什至不知道从哪里开始调试这个错误,因为它只专门发生在 Travis 工作人员身上。

(这不太可能有帮助,但这是上下文错误 https://travis-ci.com/ELLIOTTCABLE/bs-sedlex/jobs/255885673#L218-L251, and 有问题的存储库 https://github.com/ELLIOTTCABLE/bs-sedlex.)

Edit 1:以下是添加 GIT_TRACE=2 后的一些额外有趣的输出:

Fetching submodule ppx-sedlex
23:55:28.125076 git.c:439               trace: built-in: git fetch --no-prune --no-prune-tags --tags -v --recurse-submodules-default on-demand --submodule-prefix ppx-sedlex/
23:55:28.125914 run-command.c:663       trace: run_command: git-remote-https origin https://github.com/ELLIOTTCABLE/ppx-sedlex.git
23:55:28.429609 run-command.c:663       trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
23:55:28.432485 run-command.c:663       trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
23:55:28.434082 git.c:439               trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs
From https://github.com/ELLIOTTCABLE/ppx-sedlex
 = [up to date]      develop       -> origin/develop
 = [up to date]      master        -> origin/master
 = [up to date]      v1.99.4       -> v1.99.4
 = [up to date]      v1.99.4-pre.1 -> v1.99.4-pre.1
 = [up to date]      v1.99.4-pre.3 -> v1.99.4-pre.3
 = [up to date]      v1.99.4-pre.8 -> v1.99.4-pre.8
 = [up to date]      v2.0.0        -> v2.0.0
 = [up to date]      v20.0.0-pre.1 -> v20.0.0-pre.1
 = [up to date]      v20.0.0-pre.2 -> v20.0.0-pre.2
23:55:28.442482 run-command.c:1616      run_processes_parallel: preparing to run up to 1 tasks
23:55:28.442504 run-command.c:1648      run_processes_parallel: done
23:55:28.442536 run-command.c:663       trace: run_command: git gc --auto
23:55:28.443983 git.c:439               trace: built-in: git gc --auto
23:55:28.444903 run-command.c:663       trace: run_command: cd /home/vagrant/ELLIOTTCABLE/bs-sedlex/.git/modules/ppx-sedlex; unset GIT_PREFIX; GIT_DIR=. git fetch --no-prune --no-prune-tags --tags -v --recurse-submodules-default on-demand --submodule-prefix ppx-sedlex/ origin 0f509703fcd43ff4324d721a39220153bab49d4a
23:55:28.446392 git.c:439               trace: built-in: git fetch --no-prune --no-prune-tags --tags -v --recurse-submodules-default on-demand --submodule-prefix ppx-sedlex/ origin 0f509703fcd43ff4324d721a39220153bab49d4a
23:55:28.447105 run-command.c:663       trace: run_command: git-remote-https origin https://github.com/ELLIOTTCABLE/ppx-sedlex.git
23:55:28.735871 run-command.c:663       trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --thin --no-progress https://github.com/ELLIOTTCABLE/ppx-sedlex.git/
23:55:28.738885 git.c:439               trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --thin --no-progress https://github.com/ELLIOTTCABLE/ppx-sedlex.git/
error: Server does not allow request for unadvertised object 0f509703fcd43ff4324d721a39220153bab49d4a

我无法解释为什么 Git 在这里请求一个“未公布的对象”;但这显然不是 GitHub 的问题,出于某种原因,这里的命令是:

git fetch --no-prune --no-prune-tags --tags -v \
   --recurse-submodules-default on-demand \ 
   --submodule-prefix ppx-sedlex/ \
   origin 0f509703fcd43ff4324d721a39220153bab49d4a

...当我时,子模块会自动调用git fetch在父仓库中。 (再次强调,0f509703,在两个存储库中都不存在;再说一遍,完全相同的存储库,完全相同的提交,而且这种情况不会发生在 macOS 上——仅发生在 Travis 的 Linux 机器上。)


我有同样的错误:

radato$ git submodule update 
fatal: git upload-pack: not our ref somehash0
fatal: remote error: upload-pack: not our ref somehash0
fatal: Fetched in submodule path 'dashboard', but it did not contain somehash0. Direct fetching of that commit failed.

所以我取消了子模块的初始化:

radato$ git submodule deinit -f dashboard
Cleared directory 'dashboard'
Submodule 'dashboard' (ssh://[email protected] /cdn-cgi/l/email-protection/somedomain/dashboard.git) unregistered for path 'dashboard'

现在检查我得到的摘要

radato@$ git submodule summary 
* somepath1 somehash1 (2):
  < Merged in fixed_edge (pull request #2)
  < fixed broken test

* somepath2 somehash2 (2):
  < Merged in dsp_tx_freq (pull request #14)
  < Merged in v0.2.0 (pull request #13)

最终我拉了:

radato@$ git pull --prune --recurse-submodules --force 
Fetching submodule dashboard
Fetching submodule somepath1
Fetching submodule somepath2
Already up to date.
Submodule path 'somesubmodulepath1': checked out 'somehash1'
Submodule path 'somesubmodulepath2': checked out 'somehash2'

现在它又起作用了。这是状态

radato$ git status 
On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

当通过 --tags 获取 git refs 时,“upload-pack: not our ref”是什么意思? 的相关文章

随机推荐