我在github上有一个私人回购,属于一个组织.对于给定的pull请求,有一个像这样的diff文件的url:
https://github.com/<ORG>/<REPO>/pull/<PR_NUMBER>.diff
Run Code Online (Sandbox Code Playgroud)
但是repo是私有的,那么如何用curl下载这个文件呢?我生成了一个"个人访问令牌",但是如何使用它有点迷失.
我试过这个:
curl -H 'Authorization: token <TOKEN>' -H 'Accept: application/vnd.github.v3.raw' -O -L "https://github.com/<ORG>/<REPO>/pull/<PR_NUMBER>.diff"
Run Code Online (Sandbox Code Playgroud)
但发回的所有内容都是"未找到".
您可以使用api.github.com中具有不同接受内容类型的pull request url.例如
curl -H 'Authorization: token mytoken' -H "Accept: application/vnd.github.v3.diff" https://api.github.com/repos/orgname/repo/pulls/1234
Run Code Online (Sandbox Code Playgroud)
注意:请从网址中删除".diff"后缀.
| 归档时间: |
|
| 查看次数: |
591 次 |
| 最近记录: |