Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error on "git add submodule"

Tags:

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

like image 492
samvermette Avatar asked Apr 12 '12 04:04

samvermette


People also ask

How do I add a submodule to a directory?

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.


1 Answers

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.

like image 104
Brian Campbell Avatar answered Sep 18 '22 12:09

Brian Campbell