I am checking the repository from github using the following code.
private String url = "https://github.com/organization/project.git"; Git repo = Git.cloneRepository().setURI(url).setDirectory(directory).setCloneAllBranches(true).call(); for (Ref b : repo.branchList().call()) { System.out.println("(standard): cloned branch " + b.getName()); }
I am using code
Git git = Git.open(checkout);
If I chekout a branch
Git git = Git.open(new File(checkout)); //checkout is the folder with .git System.out.println(git.getRepository().getFullBranch()); CheckoutCommand checkout = git.checkout(); Ref call = checkout.setName("kalees").call();
It throws org.eclipse.jgit.api.errors.RefNotFoundException: Ref kalees cannot be resolved.
What is the problem, if I specify "master" instead of "feces" , it works fine . What change should I make to check for a specific branch?
if i use code
git.checkout().setCreateBranch(true).setName("refs/remotes/origin/kalees");
He checks the branch of feces . but when i do the operation
git.pull().call();
it throws org.eclipse.jgit.api.errors.DetachedHeadException: HEAD is disconnected . What could be, whether it is a problem with an extract or a problem with a problem?
source share