如何从私人仓库下载拉取请求?

问题描述 投票:0回答:1

我想使用java从私有仓库下载拉取请求,我有令牌。

读Jgit,我找不到方法。

有没有人对此有所了解?

java github jgit
1个回答
0
投票

link,您可以阅读有关此问题的更多信息。

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();  
}
© www.soinside.com 2019 - 2024. All rights reserved.