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.
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.
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.
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.
submodule
sections in .git/config
. If there are, remove them.git rm --cached <path_to_submodule>
.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.
In addition to the above I also had to remove .gitmodules
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With