我尝试过使用jcabi-github以下是我的代码
Github github = new RtGithub("<Oauth token>");
Iterable<Repo> repo = github.repos().iterate("");
for (Repo repo2 : repo) {
System.out.println(repo2);
}
但这是错误
{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
我正在尝试连接到我公司的git hub帐户https://github.corp.xyz.com/
任何帮助?
答案 0 :(得分:2)
我使用https://github.com/kohsuke/github-api
完成了这项工作以下是未来参考的代码:
GitHub github = GitHub.connectToEnterprise(
"https://github.corp.<abc>.com/api/v3",
"<Oauth token>");
GHContentSearchBuilder search = github.searchContent();
GHContentSearchBuilder s = search.q(<searchkeyword>);