溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

git clone子模塊沒(méi)下載全怎么辦

發(fā)布時(shí)間:2020-08-14 13:54:56 來(lái)源:億速云 閱讀:859 作者:小新 欄目:開(kāi)發(fā)技術(shù)

小編給大家分享一下git clone子模塊沒(méi)下載全怎么辦,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!

★ 1. 下載一個(gè)包含很多子模塊的工程

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

如果網(wǎng)絡(luò)不好或者其他原因?qū)е伦幽K沒(méi)有下載完全,這時(shí)用git pull是無(wú)法下載完全的。

注:這是在英文環(huán)境中執(zhí)行的結(jié)果,英文Submodule在中文環(huán)境中翻譯為“子模組”了。 

從log中可以看出,有很多子模塊(為節(jié)省篇幅,完整log略,可以自行下載測(cè)試)。

$ 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

如果你不確定子模塊是否都已經(jīng)下載完全了,也可以執(zhí)行一遍這個(gè)命令確認(rèn)一下。

★ 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)

看完了這篇文章,相信你對(duì)git clone子模塊沒(méi)下載全怎么辦有了一定的了解,想了解更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI