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

我的.gitmodule文件是这样的:

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

我克隆了这个在过去没有错误,(git子模块init紧随git子模块更新),它已经工作了一段时间。

我试图克隆这个到一个新的机器,现在我在git子模块init上得到这个错误:

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

这个路径只是Xcode中的一个空文件夹,我用它来存放来自另一个目录的项目。它不是.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中的垃圾并保持清洁。

其他回答

在查看了我的.gitmodules之后,我发现我确实在不应该出现的地方出现了一个大写字母。所以请记住,.gitmodules目录是区分大小写的

只要git rm subdir就可以了。这将删除作为索引的子目录。

我解决了删除回购和运行这个命令

git clone --recurse-submodules https://github.com/chaconinc/MainProject

在那之后,它对我来说工作得很好,因为这里没有一个选项是有用的

它的作用是:

克隆主回购 在克隆完成后立即初始化子模块

就是这样

你可以在下面这个链接找到更多信息

在.gitmodules中找不到路径“OtherLibrary/MKStore”的子模块映射 当

$ git submodule update --init

我不知道为什么会出现错误。花了一分钟,在stackoverflow中找到了答案。

$ git rm --cached OtherLibrary/MKStore

然后再次更新子模块。它工作得很好。

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

文件夹结构

xyz folder as root directory which contains 2 folder as submodule
  -- product
  -- user

从根目录执行以下命令

git rm --cached product/
git rm --cached user/

进入产品目录并执行

 git submodule update --init

进入用户目录并执行

git submodule update --init

再次进入根目录CD ..

git add --all