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

所属分类: 网络编程 / 相关技巧 阅读数: 428
收藏 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 子模块没下载全内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

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

transform实现HTML5 video标签视频比例拉伸实例详解

这篇文章主要介绍了transform实现HTML5 video标签视频比例拉伸的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

微信 小程序开发环境搭建详细介绍

这篇文章主要介绍了微信 小程序开发环境搭建详细介绍的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

微信 小程序Demo导入详细介绍

这篇文章主要介绍了微信 小程序Demo导入详细介绍的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

微信小程序搭建及解决登录失败问题

这篇文章主要介绍了微信小程序搭建及解决登录失败问题的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

微信小程序下载工具及调试详解

这篇文章主要介绍了微信小程序下载工具及调试详解的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

简单谈谈Git中的回滚操作

大家在日常开发中,经常会遇到需要将代码切回到之前的某个版本的情况,有可能是需要将代码回滚,也有可能需要查看之前的某个实现。遇到这样的情况,该怎么做呢?下面通过这篇文章来学习下Git中的回滚操作,有需要的可以参考借鉴。
收藏 0 赞 0 分享

Git的使用规范流程总结

大家都明白在团队开发中,遵循一个合理、清晰的Git使用流程,是非常重要的。否则,每个人都提交一堆杂乱无章的commit,项目很快就会变得难以协调和维护。所以这篇文章给大家分享了Git的使用规范流程,有需要的可以参考借鉴。
收藏 0 赞 0 分享

Git里多种撤销操作的最佳方法

这篇文章我们会给大家介绍关于Git里的多种撤销操作,我会讲解某些你需要“撤销”已做出的修改的常见场景,以及利用 Git 进行这些操作的最佳方法。下面来一起看看吧。
收藏 0 赞 0 分享

微信小程序学习之初探小程序

这两天“微信小程序”这个词占据了朋友圈,大有一番风起云涌之势,当然,还不可能夸张到使原生App开发人员失业这种程度。当然,作为一名技术人员,时刻保持对新技术的好奇心是必须的,所以在网上找大神的教程,搭建了一下开发环境,来学习一下这个新的开发框架。
收藏 0 赞 0 分享

微信小程序版的知乎日报开发实例

相信大家最近都被小程序刷了屏,于是趁周末赶紧撸了个小程序版的知乎日报压压惊, 这篇文章主要是总结一下这个开发体验,和踩过的坑。有需要的朋友们可以参考借鉴。
收藏 0 赞 0 分享
查看更多