No submodule mapping found in .gitmodules for path

半世苍凉 提交于 2019-12-17 21:55:52

问题


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

My git config is:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = false
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@github.com:why_ios.git
[branch "master"]
    remote = origin
    merge = refs/heads/master
[submodule "External/ios-SDNestedTable"]
    url = git@github.com:why/ios-SDNestedTable.git
[submodule "External/PSStackedView"]
    url = git@github.com:why/PSStackedView.git

and .gitmodules is:

[submodule "External/ios-SDNestedTable"]
    path = External/ios-SDNestedTable
    url = git@github.com:why/ios-SDNestedTable.git
[submodule "External/PSStackedView"]
    path = External/PSStackedView
    url = git@github.com:why/PSStackedView.git

回答1:


check that you have the proper setting in .git/modules as well. Since a few versions ago, git adds an entry there.

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.




回答2:


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

My problem case was adding hugo themes via submodule:

git submodule add https://github.com/danielkvist/hugo-terrassa-theme.git themes\terrassa

will result in a .gitmodules like:

[submodule "themes\\terrassa"]
    path = themes\\terrassa
    url = https://github.com/danielkvist/hugo-terrassa-theme.git

Which will cause problems for 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.



来源:https://stackoverflow.com/questions/14720034/no-submodule-mapping-found-in-gitmodules-for-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!