GitHub api 请求的身份验证问题

Authentication issues for GitHub api request

我正在尝试从 GitHub 上的存储库检索协作者列表,例如,我正在使用 GitHub API 的 Golang 存储库。

在 curl 中,请求如下:

curl -u "my user" https://api.github.com/repos/google/go-github/collaborators

输入密码提示后,我得到以下 JSON 结果:

{
  "message": "Must have push access to view repository collaborators.",
  "documentation_url": "https://developer.github.com/v3"
}

我如何获得推送权限?我需要自己成为合作者吗?只是为了获得项目贡献者的列表有点太多了。

How do I get push access? Do I need to become a collaborator myself? A bit too much just to get a list of a project's contributors.

一个项目的协作者和贡献者是不同的。

贡献者是提交被接受的任何人,即项目网页上的 public 信息和来自 运行 git log 的信息。 You can get project contributors from the Github API without logging in.

$ curl -s https://api.github.com/repos/google/go-github/contributors | head -20
[
  {
    "login": "willnorris",
    "id": 1112,
    "avatar_url": "https://avatars.githubusercontent.com/u/1112?v=3",
    "gravatar_id": "",
    "url": "https://api.github.com/users/willnorris",

协作者是 Github 上的项目管理员,该信息是私有的。