我需要使用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);
无效
请帮我一个有效的例子。这将非常有用。
答案 0 :(得分:0)
您可以在centic9/jgit-cookbook
中找到有关以下内容的工作示例:
Repository repository = createNewRepository();
git push
(可以推送您添加/提交的任何文件,JSON与否)