No submodule mapping found in .gitmodules for path
Asked Answered
J

2

33

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 = [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:

[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
Julietjulieta answered 6/2, 2013 at 1:22 Comment(1)
stackoverflow.com/questions/4185365/…Vaenfila
L
103

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.

Lindahl answered 6/2, 2013 at 6:20 Comment(6)
you sir, saved me from certain insanity!Wrought
I did a git rm --cached myFile but now I am unabled to do a git init on the server where it was done. I have a cluster of 4 machines and only this one is doing nothing. How to rebuild this cache?Phalangeal
ok this was a stupid question, git reset HEAD myFile and I am good again, sorry for disturb !Phalangeal
UPvote this if you are from the future where the authors of git finally implement git submodule update --init --recursive --justworkdammitThurible
For some reason, mine required single quotes around the path and would not work with out it. git rm --cached 'Classes/lib/AFKissXMLRequestOperation'Wreath
The final "Also" step worked when I had neither .gitmodules nor .git/modules - thank you!Dylan
S
3

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.

Somerset answered 2/8, 2019 at 2:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.