Я создал токен, как указано в руководстве github api.
создайте токен
mytoken="xxxx"
curl -i -H "Authorization: token ${mytoken}" \
https://api.github.com/user/repos
Команда curl может перечислить все мои репо в githubуспешно.
Создание нового публичного репо с помощью github api.
curl -i -H "Authorization: token ${mytoken}" \
-d '{ \
"name": "blog", \
"auto_init": true, \
"private": false, \
"gitignore_template": "nanoc" \
}' \
https://api.github.com/user/repos
Бесполезно создавать закрытое репо с "private": true,
.
Сообщение об ошибке длякоманда curl.
HTTP/1.1 400 Bad Request
Date: Mon, 11 Jun 2018 08:05:37 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 113
Server: GitHub.com
Status: 400 Bad Request
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4984
X-RateLimit-Reset: 1528705761
X-OAuth-Scopes: admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion
X-Accepted-OAuth-Scopes: public_repo, repo
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, Retry-After, 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: *
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Content-Security-Policy: default-src 'none'
X-Runtime-rack: 0.030100
X-GitHub-Request-Id: B6F2:2195:194110:222B23:5B1E2D50
{
"message": "Problems parsing JSON",
"
documentation_url": "https://developer.github.com/v3/repos/#create"
}