首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么git子模块更新失败与“致命:远程错误:上传包:而不是我们的参考”?

为什么git子模块更新失败与“致命:远程错误:上传包:而不是我们的参考”?
EN

Stack Overflow用户
提问于 2020-04-11 20:09:59
回答 7查看 22.7K关注 0票数 27

我有一个带有多个子模块的git。我尝试过删除和添加相关的子模块(东莨菪碱纳米兽),但是在删除和重新添加过程中,错误仍然存在。当我将回购克隆到一个新的位置时,我会用git submodule update --init --recursive自动更新它,这是当它失败时,但只对这个子模块.下面是使用GIT_TRACE=2命令的相关输出

代码语言:javascript
运行
复制
23:01:26.918691 run-command.c:1569      run_processes_parallel: preparing to run up to 1 tasks
23:01:26.933567 run-command.c:1601      run_processes_parallel: done
23:01:26.934373 run-command.c:646       trace: run_command: git gc --auto
23:01:26.966805 git.c:344               trace: built-in: git gc --auto
23:01:26.991059 git.c:344               trace: built-in: git rev-parse --local-env-vars
23:01:27.015684 git.c:344               trace: built-in: git rev-parse --local-env-vars
23:01:27.032282 git.c:344               trace: built-in: git symbolic-ref -q HEAD
23:01:27.053948 git.c:344               trace: built-in: git config --get branch.master.remote
23:01:27.073636 git.c:344               trace: built-in: git fetch origin 151d94a8754b0a612315fc191c5373cc0055c13d
23:01:27.079657 run-command.c:646       trace: run_command: git-remote-https origin https://github.com/scopatz/nanorc.git
23:01:28.441725 run-command.c:646       trace: run_command: git rev-list --objects --stdin --not --all --quiet
23:01:28.452267 run-command.c:646       trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --thin https://github.com/scopatz/nanorc.git/
23:01:28.467757 git.c:344               trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --thin https://github.com/scopatz/nanorc.git/
fatal: remote error: upload-pack: not our ref 151d94a8754b0a612315fc191c5373cc0055c13d
fatal: The remote end hung up unexpectedly
Fetched in submodule path 'submodules/nano', but it did not contain 151d94a8754b0a612315fc191c5373cc0055c13d. Direct fetching of that commit failed.

希望这里的人能帮上忙,我在这一点上基本上迷失了方向。

===编辑:===下面的解决方案步骤

代码语言:javascript
运行
复制
cd {submodule path}
git reset --hard origin/master
cd -
git clean -n
git add {submodule path}
git commit
git submodule update --init --recursive

没有错误太棒了。

EN

Stack Overflow用户

发布于 2021-08-04 07:32:51

我们的子模块也有同样的错误。由于该项目是公开可用的,为了解决这个问题,我将. .git/config中的urls中的所有值以及它们各自的子模块配置中的所有值替换为项目https而不是ssh

票数 0
EN
查看全部 7 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61163082

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档