I get the following error when I try adding a submodule to my repository:
fatal: pathspec 'submodule' did not match any files
I had some issues with my submodules so I had to remove them all (removed them from .gitmodules
, .git/config
, cleaned the index using rm --cached submodule_path
, even did git reset --mixed
).
But now I can't seem to be able to add any submodule at all! I looked through the whole .git folder in search for references to my previous submodules and couldn't find anything. Have I run out of options?
(now that I think of it I might have deleted a repository to which was referenced a submodule at some point, but that submodule is now gone so why would this be a problem?)
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.
I think you mean to use git submodule add <repository> <path>
, not git add submodule
, which would just add a file named submodule
to your index.
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