git clone 子模块没下载全的问题解决

所属分类: 网络编程 / 相关技巧 阅读数: 457
收藏 0 赞 0 分享

★ 1. 下载一个包含很多子模块的工程

例如:git clone --recursive https://github.com/caffe2/caffe2

如果网络不好或者其他原因导致子模块没有下载完全,这时用git pull是无法下载完全的。

注:这是在英文环境中执行的结果,英文Submodule在中文环境中翻译为“子模组”了。 

从log中可以看出,有很多子模块(为节省篇幅,完整log略,可以自行下载测试)。

$ git clone --recursive https://github.com/caffe2/caffe2
Cloning into 'caffe2'...
remote: Counting objects: 36771, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 36771 (delta 6), reused 7 (delta 5), pack-reused 36754
Receiving objects: 100% (36771/36771), 149.13 MiB | 2.76 MiB/s, done.
Resolving deltas: 100% (26926/26926), done.

 
(这里只以子模块protobuf为例,其他子模块略)
Submodule 'third_party/protobuf' (https://github.com/google/protobuf.git) registered for path 'third_party/protobuf'
(略)
Cloning into 'third_party/protobuf'...
remote: Counting objects: 47717, done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 47717 (delta 23), reused 23 (delta 5), pack-reused 47657
Receiving objects: 100% (47717/47717), 40.97 MiB | 59.00 KiB/s, done.
Resolving deltas: 100% (32097/32097), done.
Checking connectivity... done.
Submodule path 'third_party/protobuf': checked out 'a428e42072765993ff674fda72863c9f1aa2d268'
(略) 

★ 2. 下载子模块

git submodule update --init --recursive1

如果你不确定子模块是否都已经下载完全了,也可以执行一遍这个命令确认一下。

★ 3. 参考 git clone --help

•git 2.7.4版本:

--recursive, --recurse-submodules
 After the clone is created, initialize all submodules within, using their default settings. This is equivalent to running git submodule
 update --init --recursive immediately after the clone is finished. This option is ignored if the cloned repository does not have a
 worktree/checkout (i.e. if any of --no-checkout/-n, --bare, or --mirror is given) 

•git 2.14.1版本:

--recurse-submodules[=<pathspec]
 After the clone is created, initialize and clone submodules within based on the provided pathspec. If
 no pathspec is provided, all submodules are initialized and cloned. Submodules are initialized and
 cloned using their default settings. The resulting clone has submodule.active set to the provided
 pathspec, or "." (meaning all submodules) if no pathspec is provided. This is equivalent to running git
 submodule update --init --recursive immediately after the clone is finished. This option is ignored if
 the cloned repository does not have a worktree/checkout (i.e. if any of --no-checkout/-n, --bare, or
 --mirror is given)

 到此这篇关于git clone 子模块没下载全的问题解决的文章就介绍到这了,更多相关git clone 子模块没下载全内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

更多精彩内容其他人还在看

firefox 扩展开发技巧

firefox 扩展开发
收藏 0 赞 0 分享

php asp.net 比较 [推荐]

如今当提到 Web 开发时,您有许多选择。这些方法中许多都涉及到预处理 - 即,利用特定的标记将代码嵌入到 HTML 页面中
收藏 0 赞 0 分享

UTF-8 BOM 可能导致样式错乱的解决方法

utf-8 是一种在web应用中经常使用的一种 unicode 字符的编码方式,使用 utf-8 的好处在于它是一种变长的编码方式,对于 ANSII 码编码长度为1个字节,这样的话在传输大量 ASCII 字符集的网页时,可以大量节约网络带宽。
收藏 0 赞 0 分享

Web 开发常用工具 大家自己查找下载

看到了Web通信分析工具 这篇文章,除了burpsuite其他我日常都经常使用。于似乎我整理了一下我自己用的其他的WEB开发工具。
收藏 0 赞 0 分享

遇到不能复制的网站怎么办?

有时我们看到喜欢的网页内容时定会产生复制下来为我所用的冲动,不过当你点击鼠标时它却没有任何反应,选择的内容没有任何变化,不禁有点扫兴。不要紧,办法总比困难多!
收藏 0 赞 0 分享

URL 长度有限制吗?

众所周知, 传递小量参数(在没有其他原因,例如隐藏参数值的情况下)推荐使用GET方法,传递大量参数推荐使用POST方法。原因是什么呢?
收藏 0 赞 0 分享

声音验证码制作方法

收听验证码已经比较普遍了,使用户看不清楚的情况下可以通过耳朵来收听验证码,但网上搜了很久没看到有具体的制作方法,自己想了想,还是按自己的方法来实现了,呵呵。
收藏 0 赞 0 分享

防范SQL注入式攻击

SQL注入式攻击是利用是指利用设计上的漏洞,在目标服务器上运行Sql命令以及进行其他方式的攻击动态生成Sql命令时没有对用户输入的数据进行验证是Sql注入攻击得逞的主要原因。
收藏 0 赞 0 分享

Web 设计与开发者必须知道的 15 个站点

今天读到一篇文章,介绍了15个对 Web 设计与开发师极端有用的站点,里面有不少也是我们一直在使用的,也许对很多人都有用,翻译出来以饷同仁。
收藏 0 赞 0 分享

十分钟内学会 避免用户刷新导致重复POST提交

在Web应用中,采用POST提交信息是非常常见的,然而如果目标页面打开得太慢,用户就可能会刷新页面,这时候之前已经提交过的信息就会被重复提交。
收藏 0 赞 0 分享
查看更多