【问题标题】:get the full_name of a repository through the github API通过 github API 获取存储库的全名
【发布时间】:2018-07-25 10:31:33
【问题描述】:

我想仅使用其名称来获取有关 github 存储库的一些信息。为此,我将我的 url 构建为 https://api.github.com/repos/:owner/<TheName> 但当然它不起作用,因为我需要 :owner 字段。我在 github api 文档页面上找到了许多获取不同信息的方法,但没有一种方法可以获取所有者。有没有什么方法可以轻松搞定?

例如对于输入“spring-boot” repo,api 应该返回 full_name 即 spring-projects/spring-boot (因为 spring-boot 的 git url 是 https://github.com/spring-projects/spring-boot)。

感谢您的帮助。

【问题讨论】:

    标签: git github github-api github-api-v3


    【解决方案1】:

    这是不可能的,原因很简单!不同的用户可以为他们的存储库使用相同的名称! 例如,user_1 可以有一个名为:foo (user_1/foo) 的存储库,而 user_2 也可以有另一个名为 foo 的存储库! (user_2/foo)。因此无法保证您拥有给定名称的唯一存储库。

    如果您想从 Github 获取名为 foo 的所有公共存储库的列表,我认为目前没有用于处理该问题的 API。

    【讨论】:

    • 那我认为不可能通过github API(仅使用repo名称)获取存储库的源URL?
    猜你喜欢
    • 2014-09-21
    • 1970-01-01
    • 1970-01-01
    • 2017-09-01
    • 2019-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多