无法使用curl将二进制文件上传到GitHub

时间:2016-12-13 16:01:56

标签: curl github

我尝试将二进制文件从CLI上传到GitHub特定标记。

关于DOCS:https://developer.github.com/v3/repos/releases/

现在我尝试使用curl但它失败了:

curl -H "Authorization: token faa1217373f025abf8a683539e00ce98694c17da" \
     -H "Content-Type: multipart/form-data;" \
     -H "Content-Type: application/zip" \
     --data-binary @Tracker.framework.zip \   "https://uploads.github.com/repos/SDK/FWTestBuild/releases/tag/1.2.27/assets?name=Tracker.framework.zip"
--verbose

但得到错误:

*   Trying 192.30.253.96...
* Connected to uploads.github.com (192.30.253.96) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.github.com
* Server certificate: DigiCert SHA2 High Assurance Server CA
* Server certificate: DigiCert High Assurance EV Root CA
> POST /repos/SDK/FWTestBuild/releases/tag/1.2.27/assets?name=Tracker.framework.zip HTTP/1.1
> Host: uploads.github.com
> User-Agent: curl/7.49.1
> Accept: */*
> Authorization: token faa1217373f025abf8a683539e00ce98694c17da
> Content-Type: multipart/form-data;
> Content-Type: application/zip
> Content-Length: 739956
> Expect: 100-continue
> 
< HTTP/1.1 500 Internal Server Error
< Access-Control-Allow-Origin: *
< Content-Length: 64
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json
< Strict-Transport-Security: max-age=31557600
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Xss-Protection: 1; mode=block
< Date: Tue, 13 Dec 2016 15:39:26 GMT
< X-GitHub-Request-Id: 1FA8AE8E:1A14:2E0DCC:5850162D
* HTTP error before end of send, stop sending
< 
* Closing connection 0
{"message":"Error","request_id":"1FA8AE8E:1A14:2E0DCC:5850162D"}

1 个答案:

答案 0 :(得分:1)

您确定自己的URI https://uploads.github.com/repos/SDK/FWTestBuild/releases/tag/1.2.27/assets?name=Tracker.framework.zip 真的对应于模板

https://<upload_url>/repos/:owner/:repo/releases/:id/assets?name=foo.zip

PLS。考虑到<upload_url>必须从&#34;获得单个版本&#34;查询API。