[英]How to get git logs directly from github.com without checking out the repo?
Like I want to run the command(git log --since=2.days) from any remote host to github repo and get logs to the VM without the need of cloning the repo and then running the command mentioned before. 就像我想从任何远程主机运行命令(git log --since = 2.days)到github repo并获取日志到VM一样,而无需克隆repo然后运行前面提到的命令。
What will be the best approach to get the logs from the origin without checking out the code. 什么是从原始位置获取日志而不检出代码的最佳方法。
The Git protocol doesn't support this, but GitHub has an HTTP API to query information about repositories hosted there. Git协议不支持此功能,但是GitHub有一个HTTP API可以查询有关托管在此处的存储库的信息。
Direct link (also read the main page about the API to see how to authenticate using an API key, if you need to access information for a private repository): https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository 直接链接(如果需要访问私有存储库的信息,也请阅读有关API的主页,以了解如何使用API密钥进行身份验证): https : //developer.github.com/v3/repos/commits/#列表提交-ON-A-库
Example: 例:
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/git/git/commits?sha=master&since=2019-03-18T11:00:00Z
Side note: GitHub also offers a GraphQL API and seems to be planning to phase out the previous APIs, but its documentation is significantly less easy to understand. 旁注:GitHub还提供了GraphQL API,并且似乎正计划逐步淘汰以前的API,但是其文档明显不那么容易理解。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.