下载 GitHub 历史记录(提交、消息、分支、贡献者……)

Download GitHub history (commits, message, branches, contributors, ...)

有没有办法下载我自己的帐户或我作为贡献者的组织的 GitHub 历史记录?

我找到了关于如何查看提交历史的页面,这很令人愉快,但我无法下载 json 结构中的信息,例如:Link

因此,我想以结构化的方式下载以下信息:

克隆存储库

最简单的版本是只 clone 存储库而不签出分支:

git clone --bare <url>

这会下载包含所有提交及其响应信息(包括日期和贡献者)的存储库。

然后您可以使用 git 命令(如 Git Pro as you mentioned 或 git 包装器(如 libgit2 中所示)访问所需的所有信息。

使用GitHubAPI

另一种可能性是使用 GitHub API for querying repositories

您可以使用 URL https://api.github.com/repos/{owner}/{repo}.

获取存储库信息

如果您想从存储库获取提交信息,请使用它的 commit_url 字段(通常是 https://api.github.com/repos/{owner}/{repo}/commits.

有了分支,可以使用branch_url (https://api.github.com/repos/{owner}/{repo}/branches).