致命:远程错误:上传包:不是我们的参考



我们只在CI上看到一个奇怪的错误。我们有一个git存储库(让我们称之为"OUTER"(,它包含一个子模块("INNER"(。如果我们克隆";外部;通常在我们的开发机器和更新子模块上,我们看不到任何问题。在CI上,在奇数路Bitrise"之后;克隆";调用git fetch的repo在尝试获取子模块时抛出错误。

以下是输出示例。注意前几行模拟了Bitrise";克隆";回购。

➜ test git "init"
git "remote" "add" "origin" "git@github.com:COMPANY/OUTER.git"
git "fetch" "--jobs=10" "--no-tags" "origin" "refs/heads/master"
git "checkout" "master"
git "merge" "origin/master"
git "submodule" "update" "--init" "--recursive" "--jobs=10"
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint:   git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint:   git branch -m <name>
Initialized empty Git repository in /Users/lnatan/Desktop/test/.git/
remote: Enumerating objects: 48542, done.
remote: Counting objects: 100% (4094/4094), done.
remote: Compressing objects: 100% (989/989), done.
remote: Total 48542 (delta 3383), reused 3623 (delta 3082), pack-reused 44448
Receiving objects: 100% (48542/48542), 178.80 MiB | 5.71 MiB/s, done.
Resolving deltas: 100% (35468/35468), done.
From github.com:COMPANY/OUTER
* branch              master     -> FETCH_HEAD
* [new branch]        master     -> origin/master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Already on 'master'
Already up to date.
Submodule 'Submodules/INNER' (git@github.com:COMPANY/INNER.git) registered for path 'Submodules/INNER'
Cloning into '/Users/lnatan/Desktop/test/Submodules/INNER'...
Submodule path 'Submodules/INNER': checked out '174a9f60014e3cead89242178c534aeaff769dc7'
➜  test git:(master) 
➜  test git:(master)                                                                                                                                                                                             
➜  test git:(master) 
➜  test git:(master) git fetch
remote: Enumerating objects: 9001, done.
remote: Counting objects: 100% (4953/4953), done.
remote: Compressing objects: 100% (2833/2833), done.
remote: Total 4461 (delta 3443), reused 2361 (delta 1527), pack-reused 0
Receiving objects: 100% (4461/4461), 6.16 MiB | 3.41 MiB/s, done.
Resolving deltas: 100% (3443/3443), completed with 399 local objects.
From github.com:COMPANY/OUTER
= [up to date]        master                                              -> origin/master
* [new branch]        ...
* [new tag]           ...
Fetching submodule Submodules/INNER
fatal: remote error: upload-pack: not our ref 57df880c914a482c26a1db9b388a34ee55e22730
Errors during submodule fetch:
Submodules/INNER

使用GIT_TRACE=2--verbose产生以下输出:

➜  test git:(master) GIT_TRACE=2 git fetch --tags --verbose
02:04:41.644506 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/bin/git
02:04:41.644795 exec-cmd.c:238          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/bin
02:04:41.645153 git.c:455               trace: built-in: git fetch --tags --verbose
02:04:41.645516 run-command.c:667       trace: run_command: unset GIT_PREFIX; GIT_PROTOCOL=version=2 ssh -o SendEnv=GIT_PROTOCOL git@github.com 'git-upload-pack '''COMPANY/OUTER.git''''
remote: Enumerating objects: 9300, done.
remote: Counting objects: 100% (5243/5243), done.
remote: Compressing objects: 100% (3091/3091), done.
02:04:48.411851 run-command.c:667       trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 30246 on Leo-Natans-Inv-MBP.local' --pack_header=2,4750
02:04:48.417901 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git
02:04:48.418587 exec-cmd.c:238          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
02:04:48.419008 git.c:455               trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 30246 on Leo-Natans-Inv-MBP.local' --pack_header=2,4750
remote: Total 4750 (delta 3673), reused 2442 (delta 1552), pack-reused 0
Receiving objects: 100% (4750/4750), 6.22 MiB | 3.51 MiB/s, done.
Resolving deltas: 100% (3673/3673), completed with 400 local objects.
02:04:50.742376 run-command.c:667       trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
02:04:50.747795 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git
02:04:50.748441 exec-cmd.c:238          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
02:04:50.748944 git.c:455               trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs
From github.com:COMPANY/OUTER
= [up to date]        master                                              -> origin/master
* [new branch]        ...
* [new tag]           ...
02:04:51.133204 run-command.c:1628      run_processes_parallel: preparing to run up to 1 tasks
02:04:51.133359 run-command.c:667       trace: run_command: cd /Users/lnatan/Desktop/test/.git/modules/Submodules/INNER; unset GIT_PREFIX; GIT_DIR=. git fetch --no-prune --no-prune-tags --tags -v --recurse-submodules-default on-demand --submodule-prefix Submodules/INNER/
Fetching submodule Submodules/INNER
02:04:51.135930 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git
02:04:51.136231 exec-cmd.c:238          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
02:04:51.136416 git.c:455               trace: built-in: git fetch --no-prune --no-prune-tags --tags -v --recurse-submodules-default on-demand --submodule-prefix Submodules/INNER/
02:04:51.136872 run-command.c:667       trace: run_command: unset GIT_DIR GIT_PREFIX; GIT_PROTOCOL=version=2 ssh -o SendEnv=GIT_PROTOCOL git@github.com 'git-upload-pack '''COMPANY/INNER.git''''
02:04:55.589678 run-command.c:667       trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
02:04:55.600024 run-command.c:667       trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
02:04:55.603178 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git
02:04:55.603586 exec-cmd.c:238          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
02:04:55.603916 git.c:455               trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs
From github.com:COMPANY/INNER
= [up to date]      ...
02:04:55.938232 run-command.c:1628      run_processes_parallel: preparing to run up to 1 tasks
02:04:55.938375 run-command.c:1660      run_processes_parallel: done
02:04:55.938496 run-command.c:667       trace: run_command: git maintenance run --auto --no-quiet
02:04:55.946682 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git
02:04:55.947423 exec-cmd.c:238          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
02:04:55.948094 git.c:455               trace: built-in: git maintenance run --auto --no-quiet
02:04:55.951412 run-command.c:667       trace: run_command: cd /Users/lnatan/Desktop/test/.git/modules/Submodules/INNER; unset GIT_PREFIX; GIT_DIR=. git fetch --no-prune --no-prune-tags --tags -v --recurse-submodules-default on-demand --submodule-prefix Submodules/INNER/ origin 57df880c914a482c26a1db9b388a34ee55e22730
02:04:55.956634 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git
02:04:55.957121 exec-cmd.c:238          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
02:04:55.957479 git.c:455               trace: built-in: git fetch --no-prune --no-prune-tags --tags -v --recurse-submodules-default on-demand --submodule-prefix Submodules/INNER/ origin 57df880c914a482c26a1db9b388a34ee55e22730
02:04:55.958394 run-command.c:667       trace: run_command: unset GIT_DIR GIT_PREFIX; GIT_PROTOCOL=version=2 ssh -o SendEnv=GIT_PROTOCOL git@github.com 'git-upload-pack '''COMPANY/INNER.git''''
fatal: remote error: upload-pack: not our ref 57df880c914a482c26a1db9b388a34ee55e22730
02:05:00.643367 run-command.c:1660      run_processes_parallel: done
Errors during submodule fetch:
Submodules/INNER
02:05:00.644990 run-command.c:667       trace: run_command: git maintenance run --auto --no-quiet
02:05:00.652674 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git
02:05:00.653655 exec-cmd.c:238          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core
02:05:00.654379 git.c:455               trace: built-in: git maintenance run --auto --no-quiet

我不知道57df880c914a482c26a1db9b388a34ee55e22730是从哪里来的。我在任何地方都找不到它的参考资料,但我可能不知道该去哪里找。有什么帮助吗?

感谢

57df880c914a482c26a1db9b388a34ee55e22730来自超级项目中的提交(引用子模块的存储库(。您的CCD_ 6操作正在";递归的";模式,尝试使用超级项目中的指令在每个子模块中运行git fetch。不幸的是,超级项目中的指令要么完全错误,要么是远程(子模块最初克隆的地方(上的Git软件无法理解。

正如您在自己的评论中所指出的,git fetch --no-recurse-submodules避免了尝试运行该特定提交的递归提取。您也可以使用git config fetch.recurseSubmodules false在默认情况下禁用递归。将其设置为on-demand在这里可能起作用,也可能不起作用。

最新更新