不能用子模块推送Git仓库 [英] Can't push a commit of Git repo with a submodule
问题描述
我最近在我的repoB中添加了子模块C,然后签出了子模块C中的一个特定提交(我想包含在B中的那个工具的先前版本),然后提交B并尝试推送。我得到这个错误:
$ git push --recurse-submodules =按需
...
最新
以下子模块路径包含在任何远程计算机上都不能找到
的更改:
_submodules / C
请尝试
git push --recurse-submodules =按需
或者cd到路径并使用
git push
将它们推送到远程。
致命:中止。
致命:远程端意外挂起
gitpub错误:进程git-shell失败,状态为128
我应该提一下,我已经检查过的C中的提交是无父母/分离的(不知道为什么开发者选择这样做)。这似乎会导致一个问题,当我想在B中推送我的提交时。也可能有必要提到B也是一个超级项目A的子模块。
感谢您提供的任何洞察。
好的,对于Git来说相对较新,我错过了push命令不应该为我的目的包含 - recurse-submodules
。我相信我得到了我所做的消息,因为它认为我也想将一个提交推送给子模块,因为它没有分支。 I've recently added submodule "C" to my repo "B", then checked out a particular commit in submodule C (a previous release of that tool I want to include in B), then committed B and attempted to push. I get this error:
$ git push --recurse-submodules=on-demand
...
Everything up-to-date
The following submodule paths contain changes that can
not be found on any remote:
_submodules/C
Please try
git push --recurse-submodules=on-demand
or cd to the path and use
git push
to push them to a remote.
fatal: Aborting.
fatal: The remote end hung up unexpectedly
gitpub error: process git-shell failed with status 128
I should mention that the commit in C that I have checked out is parentless/detached (not sure why the developer opted to have it this way). This appears to cause an issue when I want to push my commit in B. It might also be relevant to mention that B is a submodule of a superproject A as well.
Thanks for any insight you may be able to provide.
Ok, being relatively new to Git, I missed that the push command should NOT have included --recurse-submodules
for my purposes. I believe I got the message I did because it thought I wanted to also push a commit to the submodule, for which there was no branch.
这篇关于不能用子模块推送Git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!