Github git在使用授权令牌创建存储库时返回401”;“不良凭证”;

Github git在使用授权令牌创建存储库时返回401”;“不良凭证”;,github,Github,当我使用follow时 curl -i -H 'Authorization: token mytoken' https://api.github.com/user/repos -d '{"name":"REPO2"}' 返回 HTTP/1.1 401 Unauthorized Server: GitHub.com Date: Sat, 04 Mar 2017 16:21:13 GMT Content-Type: application/json; charset=utf-8 Content-L

当我使用follow时

curl -i -H 'Authorization: token mytoken' https://api.github.com/user/repos -d '{"name":"REPO2"}'
返回

HTTP/1.1 401 Unauthorized
Server: GitHub.com
Date: Sat, 04 Mar 2017 16:21:13 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 93
Status: 401 Unauthorized
X-GitHub-Media-Type: github.v3; format=json
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1488646926
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: *
Content-Security-Policy: default-src 'none'
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
X-GitHub-Request-Id: C3B1:3287:955066:BB6710:58BAE978

{
  "message": "Bad credentials",
  "documentation_url": "https://developer.github.com/v3"
}
请帮助我

您可以在
Settings>Developer Settings>Personal access tokens
中创建并选择
repo
范围:

然后在您的请求中替换它:

curl -H 'Authorization: token {0123456789zeaz1224334534}' https://api.github.com/{user}/repos -d '{"name":"REPO2"}'

您正在使用的OAuth令牌无效。你真的在尝试使用“mytoken”吗?我使用curl-u'Authorization:my-token'-d'{“name”:“repo3”}解决它好开心~有没有认识田昊的