gitclone⼦模块没下载全的问题解决
★ 1. 下载⼀个包含很多⼦模块的⼯程
如果⽹络不好或者其他原因导致⼦模块没有下载完全,这时⽤git pull是⽆法下载完全的。
注:这是在英⽂环境中执⾏的结果,英⽂Submodule在中⽂环境中翻译为“⼦模组”了。
从log中可以看出,有很多⼦模块(为节省篇幅,完整log略,可以⾃⾏下载测试)。
$ git clone --recursive github/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' (github/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.active下载
Resolving deltas: 100% (32097/32097), done.
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 ⼦模块没下载全内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。