简体   繁体   中英

How can I get 'git clone --recursive' to clone submodules locally?

I'm in the habit of making a git clone to a master location on my disk and then using a local git clone from there to cut down on download and copy times.

However, if I clone a project that has submodules, git clone --recursive , it will use --local for the main repo, but the submodule initialization is still by reference to URLS, which means I'm still going and doing a download again.

Is there a way to make git clone --recursive clone from the local copies of submodules instead of the canonical locations?

this is my savior always:

git submodule update --init --recursive

This, initializes submodules and clones them even if you have submodules within submodules. I have an alias in my bash_profile for this and always use this for empty repositories and for simple update operations

alias gsu='git submodule update --init --recursive'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM