I\'m using JGit to checkout a remote tracking branch.
Git binrepository = cloneCmd.call()
CheckoutCommand checkoutC
As shown in the code of CheckoutCommand, you need to set the boolean createBranch to true in order to create a local branch.
You can see an example in CheckoutCommandTest - testCreateBranchOnCheckout()
@Test
public void testCreateBranchOnCheckout() throws Exception {
git.checkout().setCreateBranch(true).setName("test2").call();
assertNotNull(db.getRef("test2"));
}