【问题标题】:Accessing commit history from github via terminal?通过终端从 github 访问提交历史?
【发布时间】:2014-11-17 02:54:45
【问题描述】:

需要一些快速帮助。新手终端用户在这里。尝试使用这些说明:https://developer.github.com/v3/repos/statistics/#commit-activity 获取特定用户的提交历史记录。

但是,我不知道该怎么办:

GET /repos/:owner/:repo/stats/contributors

当我用我正在使用的特定名称替换所有者和 repo 时,没有任何反应,因为我在终端中收到此错误:

-bash: GET: command not found

这是一个非常时间敏感的问题,求助!谢谢!

【问题讨论】:

  • 您需要使用 curl 发出 HTTP GET 请求。
  • 我试过了,但没用:“curl api.github.com/repos/:(u/n here)/:(repository here)/stats/contributors”
  • 你遇到了什么错误?
  • 说找不到,并提供了他们的开发者 github 页面的链接。
  • 终于搞定了。错字,包括“:”!

标签: macos git github terminal github-api


【解决方案1】:

你可以关注这个curl tutorial using GitHub's API,看看你会怎么翻译

GET /repos/:owner/:repo/stats/contributors

您注意到in the comments,不应包含“:”。

curl --include https://api.github.com/users/caspyin

将用户凭据传递给基本身份验证以访问受保护的资源,例如用户加星标的要点或与其个人资料相关的私人信息

curl --user "caspyin:PASSWD" https://api.github.com/gists/starred
curl --user "caspyin:PASSWD" https://api.github.com/users/caspyin

只传递不带冒号的用户名 (:) 将提示您输入帐户密码。
这样可以避免在命令行历史记录中包含您的密码

curl --user "caspyin" https://api.github.com/users/caspyin

在您的情况下,将 <owner><reponame> 替换为正确的所有者和 repo 名称:

curl https://api.github.com/repos/<owner>/<reponame>/stats/contributors

【讨论】:

    猜你喜欢
    • 2011-10-26
    • 2018-11-04
    • 2023-01-22
    • 2017-04-11
    • 2014-07-07
    • 2019-04-04
    • 1970-01-01
    • 2020-05-31
    • 2012-07-31
    相关资源
    最近更新 更多