How to clone --recursive using gcloud

Viewed 100

How do you clone submodules when using gcloud?

This does not work(note --recursive):

gcloud source repos clone <REP_NAME> --recursive --project=<PROJECT_NAME>

Also tried this, after cloning with this:

git fetch --recurse-submodules

And this:

git submodule init 
git submodule update
1 Answers

gcloud source repos clone command is a small wrapper around git, but it does not pass through all clone flags to git. If you run it with --dry-run flag

gcloud source repos clone <REP_NAME> --project=<PROJECT_NAME> --dry-run

it will print git clone command it uses under the hood. You can then run this command directly with --recurse-submodules flag (--recursive has been deprecated as of git 2.13).

Alternatively you can run gcloud clone and then use git

git submodule update --init --recursive
Related