Empty Git submodule folder when repo cloned
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
Related videos on Youtube
jcubic
My name is Jakub T. Jankiewicz, I'm coding mostly in JavaScript. I love Lisp Macros, jQuery library, ReactJS, CSS3, HTML5, SVG, GNU/Linux, GNU Emacs and Inkscape. Working with JavaScript and R for Roche/Genentech via Astek Poland. my english blog - In Code We Trust my polish blog - Głównie JavaScript (ang. Mostly JavaScript) Usefull Links Other links Yet another links Few of my JavaScript Open Source projects: jQuery Terminal: JavaScript library for Web based Terminal Emulator LIPS - Powerful Scheme based lisp interpreter written in JavaScript sysend.js: Library for sending messages between Windows and Tabs Gaiman Programming Language and Text based Game engine GIT Web Terminal Posts: EchoJS News, EchoJS News (2), HackerNews
Updated on October 13, 2021Comments
-
jcubic over 2 years
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?
-
Charlie Parker about 3 yearsif you forgot the
--recursive
flag in your git clone then you can dogit submodule update --init
-
jcubic about 3 years@CharlieParker it's in accepted answer first comment.
-
-
Amber almost 12 yearsYep. You can also fetch submodules after the fact with
git submodule update --init
, if you already cloned but forgot--recursive
. -
d4Rk about 11 yearsJust faced the problem that there is a submodule on develop branch, but not yet on the master branch. When you clone the git repo using --recursive it will not find the submodule on the master branch, and you have to fetch it using Ambers comment "git submodule update --init" to get also the subomdule.
-
Noitidart over 7 yearsIf you use
git submodule update --init
you will have to go to each repo and dogit checkout master
otherwise you'll get errorYou are not currently on a branch.
ongit pull
when you try to update it to a newer version. -
borgr over 6 years@Noitidart is there a way that doesn't do that? (after cloning the project already)
-
Noitidart over 6 years@borgr i couldn't figure it out
-
Jari Turkia almost 6 years@Noitidart Thanks for the
update --init
hint. That does help when original clone didn't have--recursive
in it and simply wanting to pull the missing submodules. -
Noitidart almost 6 yearsThanks for that note @JariTurkia - I didn't know I needed that because I had forgot
--recursive
.