Home > Software design >  Eclipse - how to git clone --depth 1
Eclipse - how to git clone --depth 1

Time:01-27

I have to import a quite big (bitbucket) git repository in Eclipse. Right now Eclipse is stuck cloning from an hour. To speed up things I'd like to clone it in "shallow" mode (just taking the last commit).

I tested this with the CLI git clone --depth 1 https://bitbucket.myco.local:8443/scm/big/quite-big-project.git and it worked well: it took less than 2 minutes. Anyway I have to clone the project into eclipse and have no idea about how to set the depth in Eclipse's git import project wizard.

CodePudding user response:

Unfortunately, JGit, the pure Java implementation of git used by Eclipse does not yet support the --depth option:

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

There is bug open for it over at bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475615

I would recommend cloning it via the normal git command line, and then using the "add existing local repo" button from the Git perspective:

Click here to view a screenshot

CodePudding user response:

I worked-around like this (in a way similar as what suggested @mboot):
1> I cloned the repository with CLI and --depth 1 option
2> I followed the procedure of import from git using "filesystem" protocol
3> Unbound the "filesystem" origin (git remote remove origin)
4> Added the "actual" remote git remote add origin https://bitbucket.myco.local:8443/scm/big/quite-big-project.git
5> Hoped for the best

  •  Tags:  
  • Related