Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Clone single branch does not work
Clone single branch does not work [message #1758136] Thu, 23 March 2017 15:22
Eclipse UserFriend
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: Sun Jul 06 17:19:34 EDT 2025

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

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

Back to the top