从Github检索私有存储库的提交记录

6
我需要从GitHub的私有仓库中检索所有提交记录。
我已经尝试使用GitHub API文档。它提供了检索公共存储库提交的API。 https://api.github.com/repos/:owner/:repo/commits 有人可以帮助我获取私有存储库的所有提交吗?
2个回答

5

私有仓库意味着你需要进行身份验证才能执行查询(这里是获取提交记录)。
如果你拥有私有仓库,那么这样应该可以:

curl -u 'username:password' https://api.github.com/repos/:owner/:repo/commits

你如何将这扩展到双因素身份验证? - user1065985
1
@Feras 嗯...首先,在我回答的时候,GitHub还没有两步验证(2012年11月与2013年9月相比:https://github.com/blog/1614-two-factor-authentication);其次,您需要一个X-GitHub-OTP头:https://dev59.com/s4bca4cB1Zd3GeqPXI28#27747524或https://dev59.com/6XnZa4cB1Zd3GeqPoUxD。 - VonC

0

您还可以创建用于特定用途的个人访问令牌... 在这里

enter image description here

使用Postman:

https://api.github.com/repos/:owner/:repo/commits enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接