Git – Fatal error on “git add submodule”

git

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?)

Best Solution

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.