簡體   English   中英

Eclipse - 如何克隆 git --depth 1

[英]Eclipse - how to git clone --depth 1

我必須在 Eclipse 中導入一個相當大的 (bitbucket) git 存儲庫。現在 Eclipse 被卡住了一個小時的克隆。 為了加快速度,我想以“淺”模式克隆它(只進行最后一次提交)。

我用 CLI git clone --depth 1 https://bitbucket.myco.local:8443/scm/big/quite-big-project.git測試了它,效果很好:用了不到 2 分鍾。 無論如何,我必須將項目克隆到 eclipse 中,並且不知道如何在 Eclipse 的 git 導入項目向導中設置深度。

不幸的是, JGit ,Eclipse 使用的 git 的純 Java 實現還不支持--depth選項:

$ jgit clone --depth=1 https://github.com/eclipse-linuxtools/org.eclipse.linuxtools.eclipse-build.git
fatal: "--depth" is not a valid option

在 bugzilla 上打開了一個錯誤: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475615

我建議通過普通的 git 命令行克隆它,然后從 Git 角度使用“添加現有本地倉庫”按鈕:

單擊此處查看屏幕截圖

我像這樣解決了問題(與@mboot建議的方式類似):
1> 我使用 CLI 和--depth 1選項克隆了存儲庫
2> 我遵循使用“文件系統”協議從 git 導入的程序
3> 解綁“文件系統”原點( git remote remove origin
4> 添加了“實際”遠程git remote add origin https://bitbucket.myco.local:8443/scm/big/quite-big-project.git
5> 希望是最好的

android 13 現在可以使用jgit 6.3.0 (淺深度)

(因為 jgit 6.3.0 用戶 OutputStream.transferTo 方法)見 android 13 api 33

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM