所以我试图从我所有者的虚拟组织中删除一堆回购(我是贡献者)。我在这里关注GitHub文档 - https://developer.github.com/v3/repos/#delete-a-repository
由于它是GitHub Enterprise帐户,因此URL端点略有不同。
这是我的cURL命令,它为我抛出错误:
curl -i -H 'Authorization: token {token}' DELETE 'https://{hostname}/api/v3/repos/{myUsername}/{reponame}'
我做的事情有什么不对吗?我在这里查找了类似的问题之后尝试了不同的组合,但似乎没有任何效果。
这是cURL输出:
curl: (6) Could not resolve host: DELETE
HTTP/1.1 404 Not Found
Server: GitHub.com
Date: Thu, 14 Sep 2017 16:45:20 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 102
Status: 404 Not Found
X-OAuth-Scopes: repo, user
X-Accepted-OAuth-Scopes: repo
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: ce484b8e-e6fb-41b3-aaca-65b047be1e3f
Content-Security-Policy: default-src 'none'
Strict-Transport-Security: max-age=31536000; includeSubdomains
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/enterprise/2.9/v3"
}
答案 0 :(得分:1)
当文件说:
DELETE /repos/:owner/:repo
它指示您使用HTTP动词“DELETE”,这是使用“-X DELETE”在curl中完成的:
curl -i -X DELETE -H 'Authorization: token {token}' 'https://{hostname}/api/v3/repos/{myUsername}/{reponame}'
(我还没有测试过,所以可能还有其他问题,但希望它会有所帮助。)
答案 1 :(得分:1)
你的卷曲请求是错误的。以下应该有效:
curl -i -H 'Authorization: token {token}' -X 'DELETE' 'https://{hostname}/api/v3/repos/{myUsername}/{reponame}'
DELETE这里是一个HTTP方法,就像GET和POST一样。在curl中,您需要在-X参数中指定HTTP方法。