git clone 子模块没下载全的问题解决
程序员文章站
2022-06-22 11:47:56
★ 1. 下载一个包含很多子模块的工程例如:git clone --recursive https://github.com/caffe2/caffe2如果网络不好或者其他原因导致子模块没有下载完全,...
★ 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 子模块没下载全内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
上一篇: c++ 面向对象设计五大原则
下一篇: js实现搜索提示框效果