簡體   English   中英

如何使用Java和github API連接到github存儲庫

[英]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找到有關以下方面的工作示例:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM