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.


  • Ensure that there are no submodule sections in .git/config . If there are, remove them.
  • Do git rm --cached <path_to_submodule> .

  • 除了上面的我还必须删除.gitmodules


    Adding to the answer by @kirelagin :

    Not always you need to do git rm . Sometimes, it's merely a typo in your .gitmodules . Here I made a few snapshots and commentaries on how SourceTree Git might lose track of submodules.

    链接地址: http://www.djcxy.com/p/92364.html

    上一篇: .gitmodules中找不到用于路径'LibTecho'的子模块映射

    下一篇: .gitmodules中找不到用于路径和缺少.gitmodules文件的子模块映射