Eclipse - 如何 git clone --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 上有一个 bug 未解决:https://bugs.eclipse.org/bugs/show_bug.cgi?id=475615

我建议通过正常的 git 命令行克隆它,然后从 Git 的角度使用“添加现有的本地存储库”按钮:

我worked-around喜欢这个(与@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> 希望最好