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

GitGit Submodules

Git Problem Overview


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.

Git Solutions


Solution 1 - Git

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

Solution 2 - Git

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.

Solution 3 - Git

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKim StacksView Question on Stackoverflow
Solution 1 - GitkirelaginView Answer on Stackoverflow
Solution 2 - GitTianaRView Answer on Stackoverflow
Solution 3 - GitAndreiMotingaView Answer on Stackoverflow