【问题标题】:How to connect to github repository using java and github api如何使用 java 和 github api 连接到 github 存储库
【发布时间】:2017-12-08 05:01:44
【问题描述】:

我需要使用 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); 

它不工作

请帮助我提供一个工作示例。那真的很有帮助。

【问题讨论】:

    标签: java github-api git-remote


    【解决方案1】:

    您将在centic9/jgit-cookbook 中找到工作示例,涉及:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-09
      • 2014-02-03
      • 1970-01-01
      • 2020-10-30
      • 1970-01-01
      • 1970-01-01
      • 2013-10-19
      相关资源
      最近更新 更多