如何获取 GitHub 回购的所有分叉列表?

How to get a list of all forks of a GitHub repo?

我想获取 GitHub 回购的所有分支的列表(例如 https://github.com/eternicode/bootstrap-datepicker), however I am unable to find out how to do it using octokit.net

我还想得到一个重命名的存储库,我不能只搜索存储库的名称。

有什么提示吗?

澄清:其余 api 已在此处描述 https://developer.github.com/v3/repos/forks/,但如何使用 octokit.net 进行描述?

线程有点旧,但万一其他人从 google 来到这里,我认为我会死掉它。

        private static IReadOnlyList<Octokit.Repository> retrieveGitHubRepos()
    {
        Task<IReadOnlyList<Octokit.Repository>> getRepoList = null;
        string appname = System.AppDomain.CurrentDomain.FriendlyName;
        Octokit.GitHubClient client = new Octokit.GitHubClient(new Octokit.ProductHeaderValue(ConnectionDetails.appName));
        client.Credentials = new Octokit.Credentials(ConnectionDetails.username, ConnectionDetails.password);
        Task.Run(() => getRepoList = client.Repository.GetAllForUser(ConnectionDetails.username)).Wait();
        return getRepoList.Result;
    }

最近 octokit.net 添加了该功能: https://github.com/octokit/octokit.net/blob/b07ce6e11a1b286dda0a65ee427bda3b8abcefb8/Octokit.Reactive/Clients/ObservableRepositoryForksClient.cs#L31

    /// <summary>
    /// Gets the list of forks defined for a repository
    /// </summary>
    /// <remarks>
    /// See <a href="http://developer.github.com/v3/repos/forks/#list-forks">API documentation</a> for more information.
    /// </remarks>
    /// <param name="owner">The owner of the repository</param>
    /// <param name="name">The name of the repository</param>
    public IObservable<Repository> GetAll(string owner, string name)
    {
        Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
        Ensure.ArgumentNotNullOrEmptyString(name, "name");

        return GetAll(owner, name, ApiOptions.None);
    }

对于指定存储库的其他方式,存在类似的功能。

请随时在此处编辑此用例的完整代码。

您可以通过访问:

https://api.github.com/repos/<Author>/<Repo>/forks

确保用合适的值替换 AuthorRepo