I need to create remote Github repository using java (Using my credentials) and I need to push .Json file to that repo.
I saw some examples using JGit and some other references like http://www.codeaffine.com/2015/11/30/jgit-clone-repository/
I've written small code
GitHubClient client = new GitHubClient();
client.setCredentials("username", "password");
RepositoryService service = new RepositoryService(client);
Repository repo=new Repository(); repo.setName("newRepo");
service.createRepository(repo);
It isn't working
Please help me with a working example. That would be really helpful.
You will find working examples in centic9/jgit-cookbook
, regarding:
Repository repository = createNewRepository();
git push
(which can push any file you have added/commit, JSON or not)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.