Git 子模块没有名称和其他问题
我正在遵循一些(相当杂乱的)在线教程来使用 Git 子模块,因为这是我第一次。
git submodule
总是吐出一长串不相关的路径(可能是 PATH
env?),没有明显的原因,但有一个更糟糕的问题:
Xkeeper@RECYCLEBIN4400 /F/_secret/Kushura (master)
$ git submodule sync
No submodule mapping found in .gitmodules for path 'D:\Programs\Git/libexec/git-core;D:\Programs\Git\libexec\git-core; <long list of directories omitted...>'
Synchronizing submodule url for ''
Synchronizing submodule url for 'hump'
$
我不明白为什么它报告没有名称,因为 .gitmodules
都已正确命名:
$ cat .gitmodules
[submodule "HardonCollider"]
path = HardonCollider
url = git://github.com/vrld/HardonCollider
[submodule "hump"]
path = hump
url = git://github.com/vrld/hump
同时,.git/config
有一个不会消失的虚拟子模块,并且每当我尝试时都会重新出现git submodulesync
(即使在删除它之后):
[submodule "HardonCollider"]
url = git://github.com/vrld/HardonCollider
[submodule "hump"]
url = git://github.com/vrld/hump
[submodule ""]
url =
出现的一个问题是 HardonCollider
模块未在 GitHub 上正确链接,而 hump
> 模块正在链接到正确的存储库并提交。我也无法弄清楚为什么会发生这种情况。
除了破坏存储库并再次尝试之外,我不知道下一步要尝试什么。
I was following some (rather disjointed) tutorial online for working with Git submodules, since it was my first time.
git submodule
always spits out a long list of unrelated paths (probably PATH
env?) for no immediate obvious reason, but there is a much worse issue:
Xkeeper@RECYCLEBIN4400 /F/_secret/Kushura (master)
$ git submodule sync
No submodule mapping found in .gitmodules for path 'D:\Programs\Git/libexec/git-core;D:\Programs\Git\libexec\git-core; <long list of directories omitted...>'
Synchronizing submodule url for ''
Synchronizing submodule url for 'hump'
$
I cannot figure out why it is reporting no name, because both .gitmodules
has it named properly:
$ cat .gitmodules
[submodule "HardonCollider"]
path = HardonCollider
url = git://github.com/vrld/HardonCollider
[submodule "hump"]
path = hump
url = git://github.com/vrld/hump
At the same time, .git/config
has a phantom submodule that won't go away, and reappears any time I try to git submodule sync
(even after removing it):
[submodule "HardonCollider"]
url = git://github.com/vrld/HardonCollider
[submodule "hump"]
url = git://github.com/vrld/hump
[submodule ""]
url =
One problem that occurred is that the HardonCollider
module isn't linking on GitHub properly, while the hump
module is linking to the proper repo and commit. I cannot figure out why this is happening, either.
Outside of just nuking the repo and trying again I have no idea what to try next.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在摸索着尝试完成任何事情之后,除了完全破坏存储库并再次尝试之外,没有任何效果。
最后我不得不从头开始重新启动我的存储库并重新添加子模块,现在它可以正常工作了。
我仍然有该存储库的原始副本,因此如果您可以提出更好的答案,我会接受。
After fumbling with trying to accomplish anything, nothing worked except nuking the repo entirely and trying again.
In the end I had to restart my repo from the beginning and re-add the submodules, and it works properly now.
I still have the original copy of the repo, so if you can suggest a better answer I will accept that instead.
子模块函数是脚本化的,而不是用 C 语言编码的。它们位于(相同的)
git-submodule
和git-submodule.sh
文件中。该代码包括许多交叉检查,以确保事情如他们所认为的那样,如果不喜欢就退出。您也许可以从代码中获得一些灵感,并将其与失败的存储库的内容进行比较。我没有深入到代码检查的底部(我是因为其他原因阅读的)
在Msysgit中,源代码位于
C:\msysgit178\git\git-submodule
(这是我的V1.1)。 7.8 副本)在 Github 上
The submodules functions are scripted, rather than coded in C. They are in the (identical)
git-submodule
andgit-submodule.sh
files. The code includes a number of cross checks that things are what they think they are, and quit's out if it doesn't like it.You may be able to get some inspiration from the code and comparing it to the contents of your failing repo. I didn't get to the bottom of the code checks (I was reading it for other reasons)
In Msysgit, the source is at
C:\msysgit178\git\git-submodule
(that's my V1.7.8 copy)On Github here
这件事已经咬了我两次了,我已经修好了一次。我采取的步骤:
clone
或submodule update --init
以来我添加或更新的所有子模块的列表,最终我找到了一个包含工作目录文件的子模块,在 .git 文件夹中引用,但不在 .gitsubmodules 文件中。我把它到处都删除了,一切都恢复正常了。
额外说明:我使用 msysgit 并获取了巨大的路径列表,但是当我在远程测试服务器(共享主机上的 Linux 盒子)上克隆时,它给出了更多有用的错误。记不清了,但它类似于
在[我正在寻找的子模块的确切名称]中找不到子模块映射
。This has bitten me twice, and I've been able to fix it once. The steps I took:
clone
orsubmodule update --init
Eventually I found a submodule which had files the working directory, was referenced in the .git folder, but was not in the .gitsubmodules file. I removed it everywhere and things were back to normal.
Extra note: I was using msysgit and getting that huge list of paths, but when I cloned on my remote test server (linux box on shared hosting) it gave much more useful errors. Can't remember exactly, but it was something like
no submodule mapping found in [the exact name of the submodule I was looking for]
.