[英]What are the requirements to connect GitHub by using GitHub api and java
[英]How to connect to github repository using java and github api
我需要使用java创建远程Github存储库(使用我的凭据),并且需要将.Json文件推送到该存储库。
我看到了一些使用JGit的示例以及其他一些参考,例如http://www.codeaffine.com/2015/11/30/jgit-clone-repository/
我写了小代码
GitHubClient client = new GitHubClient();
client.setCredentials("username", "password");
RepositoryService service = new RepositoryService(client);
Repository repo=new Repository(); repo.setName("newRepo");
service.createRepository(repo);
没用
请给我一个可行的例子。 那真的很有帮助。
您可以在centic9/jgit-cookbook
找到有关以下方面的工作示例:
Repository repository = createNewRepository();
git push
(可以推送您添加/提交的任何文件,是否为JSON)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.