使用Jgit以编程方式检索我的Github帐户下的所有存储库 [英] Programmatically retrieve all repositories under my Github account using Jgit

查看:129
本文介绍了使用Jgit以编程方式检索我的Github帐户下的所有存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用JGit客户端时遇到了一些挑战.我将其嵌入到Java App&我想在Github上的某个帐户下获取所有存储库并显示它们.另外,我可以使用JGit在Github上直接创建一个存储库.喜欢创建远程存储库吗?

I'm having a bit of a challenge with the JGit client. I'm embedding it in a Java App & I'd like to fetch all the repositories under an account on Github and display them. Also to add on, can I create a repository direct on Github using JGit. Like Create a Remote Repository?

我已经遍历了这个链接,但对我来说似乎很普通.预先感谢

I've gone through this link but it seems generic to me. Thanks in advance

推荐答案

列表用户存储库API 是可以从任何语言(包括Java)调用的东西,与JGit无关.

The List user repositories API is something you can call from any language (including Java) and is not related to JGit.

GET /users/:username/repos

进行这些调用的Java库示例为"适用于Java的GitHub API " ,及其

An example of Java library making those calls would be "GitHub API for Java ", and its java.org.kohsuke.github.GHPerson.java#listRepositories() method

new PagedIterator<GHRepository>(
   root.retrieve().asIterator("/users/" + login + "/repos?per_page=" + pageSize, 
                              GHRepository[].class, pageSize))

一旦获得了这些用户存储库的URL,就可以从其中创建JGit存储库.

Once you get the url for those user repos, you can create JGit repos out of them.

这篇关于使用Jgit以编程方式检索我的Github帐户下的所有存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆