如何从私有Github存储库下载二进制文件?

时间:2017-07-15 15:22:57

标签: git http curl github wget

我正在尝试从我的一个私有存储库下载最新版本,我正在使用此代码下载它:

curl -i -H "Authorization: token $AUTH_KEY" \
https://api.github.com/repos/haccks/Test/releases/latest

上述请求的响应会返回资产ID(7052110)以及其他详细信息。然后我用了

curl -L -H "Accept: application/octet-stream" \
https://$AUTH_KEY:@api.github.com/repos/haccks/Test/releases/assets/7052110

并收到此错误:

{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3"
}

我还尝试了wget

wget --auth-no-challenge --header='Accept: application/octet-stream' \ 
https://$AUTH_KEY:@api.github.com/repos/haccks/Test/releases/assets/7052110

返回:

HTTP request sent, awaiting response... 404 Not Found
2017-07-15 20:46:26 ERROR 404: Not Found.

出了什么问题?

1 个答案:

答案 0 :(得分:0)

由于Call Image.source = object适用于之前的API调用,您可以尝试使用a curl with multiple headers

-H "Authorization: token $AUTH_KEY"