通过Github API创建存储库时出现404 Not Found错误?

时间:2015-02-07 20:48:44

标签: git curl github github-api

我正在尝试使用github api在特定组织下创建存储库。我在看这个site,讨论如何在特定组织下创建存储库。

我的github实例网址就像这样 - https://github.host.com

我希望我的存储库在创建之后就像这样 -

https://github.host.com/david/ClientService

所以我在curl网址下面执行,每次我都会404 Not Found -

curl -i -u david -d '{ "name": "CustomerRepo", "auto_init": true, "private": true, "gitignore_template": "nanoc" }' https://github.host.com/api/v3/user/david/repos

以下是我得到的结果 -

HTTP/1.1 404 Not Found
Server: GitHub.com
Date: Sat, 07 Feb 2015 20:43:32 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 102
Status: 404 Not Found
X-GitHub-Media-Type: github.v3
X-XSS-Protection: 1; mode=block
X-Frame-Options: deny
Content-Security-Policy: default-src 'none'
Access-Control-Allow-Credentials: true
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: fv4af52e-617c-4ga1-br2f-5cb51b1df3bb
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff

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

我在做什么事吗?

1 个答案:

答案 0 :(得分:1)

从目标网址中删除/david段。

API determines the user under which to create the repository based on authentication

  

为经过身份验证的用户创建新的存储库。

POST /user/repos