Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No submodule mapping found in .gitmodule for a path that's not a submodule

I have a project that has a submodule at lib/three20

My .gitmodule file looks like this:

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

I have cloned this in the past without errors, (git submodule init followed by a git submodule update) and it's been working for a while.

I tried to clone this to a new machine, and now I'm getting this error on git submodule init:

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

That path is just an empty folder in Xcode that I use to house the projects from the other directory. It's not part of the .gitmodules file, so I don't see where it's getting this path from.

Any ideas?

like image 934
Ben Scheirman Avatar asked Nov 15 '10 14:11

Ben Scheirman


People also ask

How do I add a submodule to a specific path?

In order to add a Git submodule, use the “git submodule add” command and specify the URL of the Git remote repository to be included as a submodule. When adding a Git submodule, your submodule will be staged. As a consequence, you will need to commit your submodule by using the “git commit” command.

What is submodule path?

Submodules - repositories inside other Git repositories This allows you to track changes in several repositories via a central one. Submodules are Git repositories nested inside a parent Git repository at a specific path in the parent repository's working directory.

How do I change the path of a submodule?

gitmodules and change the path of the submodule appropriately, and put it in the index with git add . gitmodules . If needed, create the parent directory of the new location of the submodule ( mkdir -p new/path/to ). Move all content from the old to the new directory ( mv -vi old/path/to/module new/path/to/submodule ).


2 Answers

No submodule mapping found in .gitmodules for path 'OtherLibrary/MKStore' when

$ git submodule update --init 

I didn't know why the error occur. After spending a minute and found the answer in stackoverflow.

$ git rm --cached OtherLibrary/MKStore 

and then update the submodule again. It's working fine.

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

like image 170
rajibchowdhury Avatar answered Sep 19 '22 09:09

rajibchowdhury


Following rajibchowdhury's answer (upvoted), use git rm command which is advised is for removing the special entry in the index indicating a submodule (a 'folder' with a special mode 160000).

If that special entry path isn't referenced in the .gitmodule (like 'Classes/Support/Three20' in the original question), then you need to remove it, in order to avoid the "No submodule mapping found in .gitmodules for path" error message.

You can check all the entries in the index which are referencing submodules:

git ls-files --stage | grep 160000 

Previous answer (November 2010)

It is possible that you haven't declared your initial submodule correctly (i.e. without any tail '/' at the end, as described in my old answer, even though your .gitmodule has paths which looks ok in it).

This thread mentions:

do you get the same error when running 'git submodule init' from a fresh clone?
If so, you have something wrong.

If you have no submodules, delete .gitmodules, and any references to submodules in .git/config, and ensure the Pikimal dir does not have a .git dir in it.
If that fixes the problem, check in and do the same on your cruise working copy.

Obviously, don't delete your main .gitmodules file, but look after other extra .gitmodules files in your working tree.


Still in the topic of "incorrect submodule initialization", Jefromi mentions submodules which actually are gitlinks.

See How to track untracked content? in order to convert such a directory to a real submodule.

like image 32
VonC Avatar answered Sep 18 '22 09:09

VonC