Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Clone single branch does not work
Clone single branch does not work [message #1758136] Thu, 23 March 2017 19:22
Arne Boockmeyer is currently offline Arne BoockmeyerFriend
Messages: 2
Registered: March 2015
Junior Member
Hi all,

I'm currently try to clone only the master branch of a huge repository.
Therefore I tried two different approaches:
Git.cloneRepository().setURI("repositoryurl.git").setDirectory(new File("localFolder")).setCredentialsProvider(new UsernamePasswordCredentialsProvider(username,password)).setCloneAllBranches(false).setBranch("master");

I thought, this is the same as
git clone -b master --single-branch repositoryurl.git localFolder
, but the first one clones the whole repository including all branches. The nativ git command works fine.

The second approach was:
Git.cloneRepository().setURI("repositoryurl.git").setDirectory(new File("localFolder")).setCredentialsProvider(new UsernamePasswordCredentialsProvider(username,password)).setCloneAllBranches(false).setBranchesToClone(Arrays.asList("refs/heads/master"));


I also tried a lot of mixtures of the parameters, but jGit always cloned the whole repository.
I tried it with jGit 4.4 and jGit 4.6.


Does somebody know, how to clone a single branch with jGit?

Best,
Arne
Previous Topic:Frequent [lock fail] on origin/master
Next Topic:How to get Team -> Show In History
Goto Forum:
  


Current Time: Thu Apr 25 00:04:06 GMT 2024

Powered by FUDForum. Page generated in 0.02769 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top