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

孤人 提交于 2019-12-07 05:19:24

问题


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?


回答1:


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'


来源:https://stackoverflow.com/questions/30618109/how-can-i-get-git-clone-recursive-to-clone-submodules-locally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!