java - 如何从私人仓库下载拉取请求?
问题描述
我想使用 java 从我有令牌的私人仓库下载拉取请求。
阅读Jgit,我没有找到办法。
有人对此有任何想法吗?
解决方案
从链接中,您可以阅读有关此问题的更多信息。
private String localPath;
private Repository localRepo;
private Git git;
localPath = "/home/test/git_repo_test";
remotePath = "https://github.com/test/repo_1.git";
try {
localRepo = new FileRepository(localPath + "/.git");
} catch (IOException e) {
e.printStackTrace();
}
git = new Git(localRepo);
PullCommand pullCmd = git.pull();
try {
pullCmd.call();
PullResult result = pullCmd.call();
FetchResult fetchResult = result.getFetchResult();
MergeResult mergeResult = result.getMergeResult();
mergeResult.getMergeStatus(); // this should be interesting
} catch (GitAPIException e) {
e.printStackTrace();
}
推荐阅读
- networking - 无法通过 SSH 连接到 Google Cloud Platform 上的 VM 实例
- javascript - 将输入框 2 文本更改为输入框 1 Angular 2 中的更改?
- json - Spark 读取带有请求参数的 JSON
- javascript - 在下拉菜单中显示可用房间的替代方法?
- appsflyer - 错误:程序类型已存在:com.appsflyer.AFExecutor
- javascript - Javascript - 遍历 Json 对象并获取每个项目的层次键,包括嵌套对象和数组
- java - Apache Nifi:从 csv 中删除多列
- ios - 使用“jiulongw/swift-unity”将 Unity 集成到带有 Push Extension 的 Swift 项目
- python - 遍历数据框
- javascript - 如何更改按钮的禁用属性