eclipsejgitshallow-clone

Eclipse - how to git clone --depth 1


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.


Solution

  • 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