jgit不允许我将所有分支克隆到本地。
这是我克隆回购的代码。
git = Git.cloneRepository().setURI(repositoryURL)
.setCredentialsProvider(cp)
.setDirectory(file)
.setCloneAllBranches(true)
.call();
克隆之后,我使用下面的代码打印本地+远程分支的列表
System.out.println("Showing local branches...");
List<Ref> call = git.branchList().call();
for (Ref ref : call) {
System.out.println("Branch: " + ref.getName());
}
System.out.println("Now including remote branches:");
call = git.branchList().setListMode(ListMode.ALL).call();
for (Ref ref : call) {
System.out.println("Branch: " + ref.getName());
}
这是我得到的输出。。。。。如您所见,本地分支只是显示主分支。
Showing local branches...
Branch: refs/heads/master
Now including remote branches:
Branch: refs/heads/master
Branch: refs/remotes/origin/docker
Branch: refs/remotes/origin/master
Branch: refs/remotes/origin/release
Branch: refs/remotes/origin/stage
我需要为每个远程分支手动发出分支创建命令吗?
暂无答案!
目前还没有任何答案,快来回答吧!