Reputation: 66660
I have one repo hosted at https://github.com/aikiframework/json. On my local copy, I added a submodule using the command:
git submodule add [email protected]:jcubic/json-rpc.git json-rpc
Then I did a commit and push, and the changes appear on GitHub (I can click on it). But when I clone the repo:
git clone https://github.com/aikiframework/json.git
the submodule folder json-rpc
is empty.
What am I missing here? Did I forget about something? Why is that folder empty?
Upvotes: 207
Views: 98567
Reputation: 342
Update: using git version 2.32.0.windows.2
this works as well - including sub-sub-projects!
git clone --recurse-submodules [email protected]:project/project.git
Upvotes: 0
Reputation: 66660
OK I found it, needed to add --recursive
when cloning the repo.
So the clone command ends up as:
git clone https://github.com/aikiframework/json.git --recursive
Note that if you forgot the --recursive
flag you can do (thanks to @Amber):
git submodule update --init
Note that when submodules have other submodules you need recursive option (thanks for @cpprust):
git submodule update --init --recursive
Upvotes: 356