Git 子模块没有名称和其他问题

发布于 2024-12-24 00:32:08 字数 1233 浏览 0 评论 0原文

我正在遵循一些(相当杂乱的)在线教程来使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

2024-12-31 00:32:08

在摸索着尝试完成任何事情之后,除了完全破坏存储库并再次尝试之外,没有任何效果。

  • 编辑 .git/config 以删除 URL: 不起作用。
  • 编辑 .gitmodules:不起作用。
  • 编辑模块/.git/config:不起作用。
  • 一次执行以上所有操作:不起作用。
  • 尝试重新添加子模块:不起作用。

最后我不得不从头开始重新启动我的存储库并重新添加子模块,现在它可以正常工作了。

我仍然有该存储库的原始副本,因此如果您可以提出更好的答案,我会接受。

After fumbling with trying to accomplish anything, nothing worked except nuking the repo entirely and trying again.

  • Editing .git/config to remove URL: didn't work.
  • Editing .gitmodules: didn't work.
  • Editing module/.git/config: didn't work.
  • Doing all of the above at once: didn't work.
  • Trying to re-add the submodule: didn't work.

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.

捎一片雪花 2024-12-31 00:32:08

子模块函数是脚本化的,而不是用 C 语言编码的。它们位于(相同的)git-submodulegit-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 and git-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

少跟Wǒ拽 2024-12-31 00:32:08

这件事已经咬了我两次了,我已经修好了一次。我采取的步骤:

  1. 列出自上次 clonesubmodule update --init 以来我添加或更新的所有子模块的列表,
  2. 一次删除一个,使用在这里找到三步方法:http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/
  3. 每次删除后,提交,然后
  4. 克隆项目并查看如果错误仍然存​​在。

最终我找到了一个包含工作目录文件的子模块,在 .git 文件夹中引用,但不在 .gitsubmodules 文件中。我把它到处都删除了,一切都恢复正常了。

额外说明:我使用 msysgit 并获取了巨大的路径列表,但是当我在远程测试服务器(共享主机上的 Linux 盒子)上克隆时,它给出了更多有用的错误。记不清了,但它类似于在[我正在寻找的子模块的确切名称]中找不到子模块映射

This has bitten me twice, and I've been able to fix it once. The steps I took:

  1. Made a list of all of the submodules I'd added or updated since last clone or submodule update --init
  2. Remove one at a time, using the three step method found here: http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/
  3. After each removal, commited, then
  4. Cloned the project and see if the error remains.

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].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文