I'm having an issue with creating a submodule in my project. If I create the submodule directly in the repository root, everything works fine. If the submodule is any deeper, the repository does not get cloned.
For example, this works as expected:
git submodule add git://someproject.com/.git someproject
However, when I run the following command, the project is added to .gitmodules
and an empty repository is created, but no code is pulled down (even after a git submodule update --init
). The command does not produce any output.
git submodule add git://someproject.com/.git lib/someproject
It appears that a previous attempt to add a submodule had left my repository in a bad state. I was able to clone the submodule correctly after performing these steps:
rm -rf lib/someproject
.gitmodules
file.git/config
file.git/modules/someproject
Then running the git add submodule
command again worked. Many thanks to all the answerers who pushed me in the right direction!