.gitmodule中找不到子模块的路径没有找到子模块映射

我有一个项目在lib/three20有一个子模块

我的.gitmodule文件如下所示:

[submodule "lib/three20"]
    path = lib/three20
    url = git://github.com/facebook/three20.git

我已经克隆了这个过去没有错误,( git submodule init后面跟着一个git submodule update ),它已经工作了一段时间。

我试图将它克隆到一台新机器上,现在我在git submodule init上得到这个错误:

No submodule mapping found in .gitmodules for path 'Classes/Support/Three20'

该路径只是Xcode中的一个空文件夹,用于存放来自其他目录的项目。 它不是.gitmodules文件的一部分,所以我没有看到它从哪里得到这个路径。

有任何想法吗?


在rajibchowdhury的回答(upvoted)之后, 使用git rm命令建议用于删除索引中指示子模块的特殊条目 (特殊模式为160000的'文件夹')。

如果没有在.gitmodule引用该特殊的入口路径(如原始问题中的' Classes/Support/Three20 '),则需要将其删除,以避免在路径中找到“ .gitmodules无子模块映射” “ 错误信息。

您可以检查索引中引用子模块的所有条目:

git ls-files --stage | grep 160000

先前的回答(2010年11月)

有可能你没有正确地声明你的初始子模块(即最后没有任何尾部'/',就像我以前的回答中所描述的那样,即使你的.gitmodule路径看起来不错)。

这个线程提到:

从新克隆中运行'git submodule init'时你会得到同样的错误吗?
如果是这样,你有什么问题。

如果您没有子模块,请删除.gitmodules以及对.git / config中子模块的任何引用,并确保Pikimal目录中没有.git目录。
如果这样可以解决问题,请检查您的邮轮工作副本并执行相同的操作。

显然,不要删除主要的.gitmodules文件,而是.gitmodules在工作树中.gitmodules其他额外的.gitmodules文件。


仍然在“不正确的子模块初始化”的主题中,Jefromi提到了实际上是gitlinks的子模块。

请参阅如何跟踪未跟踪内容? 以便将这样的目录转换为真实的子模块。


在'OtherLibrary / MKStore'时,在.gitmodules中找不到子模块映射

$ git submodule update --init

我不知道错误发生的原因。 花了一分钟后,在stackoverflow中找到了答案。

$ git rm --cached OtherLibrary/MKStore

然后再次更新子模块。 它工作正常。

http://en.saturngod.net/no-submodule-mapping-found-in-gitmodules


当我使用SourceTree做这些事情时,它会吐出这条消息。
我遇到的消息:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree submodule update --init --recursive
No submodule mapping found in .gitmodules for path 'SampleProject/SampleProject'
Completed with errors, see above

我的方案是我错误地应用了包含.git文件夹的项目目录。
SourceTree将此文件夹视为git子模块,但实际上不是。

我的解决方案是使用命令行来删除它。

$ git rm -r SampleProject --cached
$ git commit -m "clean up folders"

在git中清除垃圾并保持清洁。

链接地址: http://www.djcxy.com/p/16447.html

上一篇: No submodule mapping found in .gitmodule for a path that's not a submodule

下一篇: Cannot remove submodule from Git repo