服务器之家:专注于VPS、云服务器配置技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|Java教程|ASP教程|编程技术|正则表达式|C/C++|IOS|C#|Swift|Android|VB|R语言|JavaScript|易语言|vb.net|

服务器之家 - 编程语言 - 编程技术 - git clone 子模块没下载全的问题解决

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

2020-09-04 19:57爱博客大伯 编程技术

这篇文章主要介绍了git clone 子模块没下载全的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

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

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

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

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

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ 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. 下载子模块

?
1
git submodule update --init --recursive1

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

★ 3. 参考 git clone --help

•git 2.7.4版本:

?
1
2
3
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版本:

?
1
2
3
4
5
6
7
8
--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 子模块没下载全内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/u013553529/article/details/78307072

延伸 · 阅读

精彩推荐
  • 编程技术从Context源码实现谈React性能优化

    从Context源码实现谈React性能优化

    这篇文章主要介绍Context的实现原理,源码层面掌握React组件的render时机,从而写出高性能的React组件,源码层面了解shouldComponentUpdate、React.memo、PureComponen...

    魔术师卡颂5312020-12-20
  • 编程技术简单、好懂的Svelte实现原理

    简单、好懂的Svelte实现原理

    本文会围绕一张流程图和两个Demo讲解,正确的食用方式是用电脑打开本文,跟着流程图、Demo一边看、一边敲、一边学...

    魔术师卡颂4822021-11-10
  • 编程技术让开发效率倍增的 VS Code 插件

    让开发效率倍增的 VS Code 插件

    今天来分享一些提升开发效率的实用 VS Code 插件!Better Comments 扩展可以帮助我们在代码中创建更人性化的注释,有不同形式和颜色的注释供我们选择。 ...

    前端充电宝7132022-04-21
  • 编程技术用户态 Tcpdump 如何实现抓到内核网络包的?

    用户态 Tcpdump 如何实现抓到内核网络包的?

    在网络包的发送和接收过程中,绝大部分的工作都是在内核态完成的。那么问题来了,我们常用的运行在用户态的程序 tcpdump 是那如何实现抓到内核态的包...

    开发内功修炼11612021-09-08
  • 编程技术真正聪明的程序员,总有办法不加班

    真正聪明的程序员,总有办法不加班

    工作效率提升了,就可以少加班了,聪明的程序员,总会有一堆可以提升编码效率的工具?当一种工具满足不了工作需求,就去探索新的,今天纬小创就给...

    今日头条12482021-03-04
  • 编程技术2021年值得关注的React PDF 库

    2021年值得关注的React PDF 库

    今天,许多网络应用程序为其用户提供内置的PDF浏览选项。然而,选择一个并不容易,因为它们的功能远远超过显示PDF。在这篇文章中,我将评估5个React的...

    TianTianUp5222021-06-21
  • 编程技术Delphi - Indy idMessage和idSMTP实现邮件的发送

    Delphi - Indy idMessage和idSMTP实现邮件的发送

    这篇文章主要介绍了Delphi - Indy idMessage和idSMTP实现邮件的发送,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下...

    JJ_JeremyWu6592020-09-22
  • 编程技术AIOps,SRE工程师手中的利器

    AIOps,SRE工程师手中的利器

    AIOps开始成为一种极为重要的站点可靠性工程工具。它能够高效吸纳观察数据、参与数据以及来自第三方工具的数据,判断系统运行状态并保证其处于最佳...

    至顶网5962021-03-08