git 在 .gitmodules 中找不到路径的子模块映射
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14720034/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No submodule mapping found in .gitmodules for path
提问by why
When I run
当我跑
git submodule update
No submodule mapping found in .gitmodules for path 'Classes/lib/AFKissXMLRequestOperation'
But I have no submodule Classes/lib/AFKissXMLRequestOperation
in current repos
但是我Classes/lib/AFKissXMLRequestOperation
当前的 repos 中没有子模块
My git config is:
我的 git 配置是:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:why_ios.git
[branch "master"]
remote = origin
merge = refs/heads/master
[submodule "External/ios-SDNestedTable"]
url = [email protected]:why/ios-SDNestedTable.git
[submodule "External/PSStackedView"]
url = [email protected]:why/PSStackedView.git
and .gitmodules is:
和 .gitmodules 是:
[submodule "External/ios-SDNestedTable"]
path = External/ios-SDNestedTable
url = [email protected]:why/ios-SDNestedTable.git
[submodule "External/PSStackedView"]
path = External/PSStackedView
url = [email protected]:why/PSStackedView.git
回答by Adam Dymitruk
check that you have the proper setting in .git/modules
as well. Since a few versions ago, git adds an entry there.
检查您是否也有正确的设置.git/modules
。从几个版本之前开始,git 在那里添加了一个条目。
Also, the tree probably has a commit object at that path. To get rid of it you can
此外,树可能在该路径上有一个提交对象。要摆脱它,你可以
git rm --cached Classes/lib/AFKissXMLRequestOperation
that should get rid of it once and for all.
那应该一劳永逸地摆脱它。
回答by tykom
Just leaving this here for anyone using git
on Windows. It is possible to follow all of the answers online and still have it not work due to git
's handling of path separators.
E.g.:
只是把这个留在这里给git
在 Windows 上使用的任何人。可以在线跟踪所有答案,但由于 对git
路径分隔符的处理,它仍然无法正常工作。例如:
My problem case was adding hugo
themes via submodule
:
我的问题案例是hugo
通过submodule
以下方式添加主题:
git submodule add https://github.com/danielkvist/hugo-terrassa-theme.git themes\terrassa
git submodule add https://github.com/danielkvist/hugo-terrassa-theme.git themes\terrassa
will result in a .gitmodules
like:
将导致.gitmodules
类似:
[submodule "themes\terrassa"]
path = themes\terrassa
url = https://github.com/danielkvist/hugo-terrassa-theme.git
Which will cause problems for git submodule [status || init || ...]
这会导致问题 git submodule [status || init || ...]
Manually replacing the separators to:
手动将分隔符替换为:
[submodule "themes/terrassa"]
path = themes/terrassa
url = https://github.com/danielkvist/hugo-terrassa-theme.git
...solved it for me.
...为我解决了它。
Also solved the deployment on Netlify since they use *nix server images.
还解决了 Netlify 上的部署,因为他们使用 *nix 服务器映像。