我怎样才能得到'git clone --recursive'在本地克隆子模块? [英] How can I get 'git clone --recursive' to clone submodules locally?

查看:1029
本文介绍了我怎样才能得到'git clone --recursive'在本地克隆子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我习惯于将git克隆到磁盘上的主位置,然后使用本地git克隆来减少下载和复制时间。


$ b $但是,如果我克隆一个具有子模块的项目, git clone --recursive ,它将使用 - local 为主要回购,但子模块初始化仍然是通过引用URLS,这意味着我仍然会去做一次下载。



有没有如何从本地副模块而不是标准位置复制克隆到 git clone --recursive

解决方案

这是我的救星总是:

  git submodule update --init --recursive 

即使在子模块中有子模块,也会初始化子模块并对其进行克隆。
我的bash_profile中有一个别名,并且总是用它来存储空的存储库和简单的更新操作。
$ b $

 别名gsu ='git submodule update --init --recursive'


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'

这篇关于我怎样才能得到'git clone --recursive'在本地克隆子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆