我有一个项目,在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文件的一部分,所以我不知道它从哪里得到这个路径。
什么好主意吗?
我为自己解决了这个问题。一开始我是这么做的:
git submodule add --branch master [URL] [PATH_TO_SUBMODULE]
事实证明,如果你想克隆主分支,不应该使用——branch选项的规范。它抛出以下错误:
fatal: Cannot force update the current branch.
Unable to checkout submodule '[PATH_TO_SUBMODULE]'
每次你试着做
git submodule sync
这个错误将被抛出:
No submodule mapping found in .gitmodules for path '[PATH_TO_SUBMODULE]'
在.gitmodules中需要的行永远不会被添加。
所以我的解决方案是:
git submodule add [URL] [PATH_TO_SUBMODULE]
在.gitmodules中找不到路径“OtherLibrary/MKStore”的子模块映射
当
$ git submodule update --init
我不知道为什么会出现错误。花了一分钟,在stackoverflow中找到了答案。
$ git rm --cached OtherLibrary/MKStore
然后再次更新子模块。它工作得很好。
http://en.saturngod.net/no-submodule-mapping-found-in-gitmodules