How can I connect to git portal h2 using java?

I tried using jcabi-github, the following is my code

Github github = new RtGithub("<Oauth token>");
Iterable<Repo> repo =  github.repos().iterate("");
for (Repo repo2 : repo) {
    System.out.println(repo2);
}

      

But this gives an error

{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)

      

I am trying to connect to my hb2 account

https://github.corp.xyz.com/

Any help?

+3


source to share


1 answer


I did it using https://github.com/kohsuke/github-api

Here's the code for future reference:



GitHub github = GitHub.connectToEnterprise(
                        "https://github.corp.<abc>.com/api/v3",
                        "<Oauth token>");

GHContentSearchBuilder search = github.searchContent();
GHContentSearchBuilder s = search.q(<searchkeyword>);

      

+2


source







All Articles