Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No submodule mapping found in .gitmodules for path and missing .gitmodules file

When I run git submodule init, I get the following error:

No submodule mapping found in .gitmodules for path 'xxx'

I searched for a .gitmodules file and I cannot find it anywhere.

I have read this most popular SO question on the same topic. But unfortunately, I cannot solve the problem. Especially given that I no longer have .gitmodules.

According to my GitHub private repo, I still have submodules for my repository. Just that I cannot find the .gitmodules file anywhere.

like image 630
Kim Stacks Avatar asked Jun 10 '13 05:06

Kim Stacks


People also ask

Where is my .gitmodules file?

The . gitmodules file, located in the top-level directory of a Git working tree, is a text file with a syntax matching the requirements of git-config[1]. The file contains one subsection per submodule, and the subsection value is the name of the submodule.

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.

How do I update .gitmodules file?

gitmodules file to update the URL and then run git submodule sync --recursive to reflect that change to the superproject and your working copy. Then you need to go to the . git/modules/path_to_submodule dir and change its config file to update git path.


3 Answers

  1. Make sure that there are no submodule sections in .git/config. If there are, remove them.
  2. Do git rm --cached <path_to_submodule>.
like image 163
kirelagin Avatar answered Oct 18 '22 16:10

kirelagin


just got over the same issue yesterday, after having deleted by hand the entry in .gitmodules (e.g. nano .gitmodules), I had to go with

git rm --cached <pathtomodule> 

which returned a message

rm '<pathtomodule>'

then I needed a

git commit -m "delete cached modules"

and validated the submodule deletion.

like image 30
TianaR Avatar answered Oct 18 '22 16:10

TianaR


In addition to the above I also had to remove .gitmodules.

like image 42
AndreiMotinga Avatar answered Oct 18 '22 16:10

AndreiMotinga