I am trying to clone a single branch into my local using jgit library , but I am confused whether to use “refs/heads/” or “refs/remotes/origin”.
repo = Git.cloneRepository().setBranchesToClone(Arrays.asList(“refs/remotes/origin/”+ branch)).setBranch(branch).setCredentialsProvider(new UsernamePasswordCredentialsProvider(userName, pwd)).setURI(uri).setDirectory(new File(toDir)).setDepth(1).call();
If I use the above one I am getting error nothing to fetch.
repo = Git.cloneRepository().setBranchesToClone(Arrays.asList(“refs/heads/”+ branch)).setBranch(branch).setCredentialsProvider(new UsernamePasswordCredentialsProvider(userName, pwd)).setURI(uri).setDirectory(new File(toDir)).setDepth(1).call();
this is working .
Please shed some light here . Thanks
Shivansh Kaldaik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.