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

 更新时间:2020年08月13日 11:13:21   作者:爱博客大伯  
这篇文章主要介绍了git clone 子模块没下载全的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

★ 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 子模块没下载全内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • 程序员学英语的一个方法

    程序员学英语的一个方法

    这篇文章主要介绍了程序员学英语的一个方法,程序员学习英语是很有必要的,只要坚持下去,相信必有收获,需要的朋友可以参考下
    2014-08-08
  • MASA Blazor入门详细教程

    MASA Blazor入门详细教程

    MASA Blazor是一个基于 Blazor Component 和 Material Design 的 UI 组件库,接下来通过本文给大家介绍MASA Blazor入门详细教程,感兴趣的朋友一起看看吧
    2022-04-04
  • 目标检测mAP的概念及公式详解

    目标检测mAP的概念及公式详解

    这篇文章主要为大家介绍了我们在进行目标检测时需要用到的mAP概念及公式详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2022-05-05
  • Web开发/设计人员应当知道的15个网站

    Web开发/设计人员应当知道的15个网站

    建个好网站绝非易事,工欲善其事必先利其器。本文编译了15个极其有用的网站,任何一位网站开发者或设计人员都应该收藏起来
    2011-05-05
  • 微信小程序 iPhoneX底部安全区域(底部小黑条)适配(一分钟解决)

    微信小程序 iPhoneX底部安全区域(底部小黑条)适配(一分钟解决)

    iPhone X 对于微信小程序的tabbar来说,会被底部小黑条覆盖,需要处理,大概思路是,得到手机型号、分别判断样式。这篇文章主要介绍了微信小程序 iPhoneX底部安全区域(底部小黑条)适配问题,需要的朋友可以参考下
    2019-10-10
  • VSCode设置默认打开的浏览器的方法

    VSCode设置默认打开的浏览器的方法

    这篇文章主要介绍了VSCode设置默认打开的浏览器的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-08-08
  • Git远程仓库配置SSH的实现(以github为例)

    Git远程仓库配置SSH的实现(以github为例)

    本文主要介绍了Git远程仓库配置SSH的实现(以github为例),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2022-07-07
  • 算法系列15天速成 第七天 线性表【上】

    算法系列15天速成 第七天 线性表【上】

    人活在社会上不可能孤立,比如跟美女有着千丝万缕的关系,有的是一对一,有的是一对多,有的是多对多
    2013-11-11
  • wkhtmltopdf 最好用Html转pdf的工具

    wkhtmltopdf 最好用Html转pdf的工具

    这篇文章主要介绍了wkhtmltopdf 最好用Html转pdf的工具,需要的朋友可以参考下
    2017-09-09
  • 详解VScode 配置为 LaTeX 编辑器(IDE)

    详解VScode 配置为 LaTeX 编辑器(IDE)

    这篇文章主要介绍了详解VScode 配置为 LaTeX 编辑器,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-03-03

最新评论