问题描述
JGit 不允许我将所有分支克隆到本地。
这是我克隆 repo 的代码。
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
我是否必须为每个远程分支手动发出分支创建命令?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)