1

I am writing a java program which will create a github repo from the local files.For this I first have to authenticate and then make autenticated requests to github v3 api.

But I can't figure out how I do the authentication and get the access_token.I will be providing the username/password in java code,so I am not looking for a oAuth solution.

Can you please give some pointers or links which can help me get started.I could not find this on github developer site.Apart from authentication,It will also be helpful if you could provide a sample authenticated request to do something like create repo or pull request...

Please help.

vishesh
  • 2,007
  • 6
  • 32
  • 67

1 Answers1

2

You can use jcabi-github (I'm one of its developers), which does all the authentication work for you:

Github github = new RtGithub("user", "password");

Now you can create a repository:

Repo repo = github.repos().create(
  Json.createObjectBuilder().add("name", "repo-name").build()
);
yegor256
  • 102,010
  • 123
  • 446
  • 597