I'm having problems using curl
to create a repo on my GitHub.com account (no ssh).
I have created a basic static local site using Jekyll which I want to push to the GitHub.com repo (I want to host the site on <username>.github.io
and according to the instructions on GitHub pages the repo must have the same name as the folder containing the local site.
I have two-factor authentication enabled for the GitHub login, so following this post I am passing an OTP/token (generated on Applications settings in the request header using the option -H "X-GitHub-OTP":<token>
. I can log in (this post previously raised an issue about the Github login not working, which was due to not closing the string "X-GitHub-OTP"
properly), but now the login works but I now receive a response with a 400 code. Here is the curl
command I am used:
$username="<username>"
$reponame="$username.github.io"
$token="<token>"
$apidom="https://api.github.com/user/repos/"
$curl -u $username -H '{"X-GitHub-OTPOTP":$token}' -d '{"name":$reponame,"description":$repodesc}' $apidom
and the response message:
<p><strong>We didn't receive a proper request from your browser.</strong></p>
<p>Sorry about that. Please try refreshing and contact us if the problem persists.</p>
<div id="suggestions">
<a href="https://github.com/contact">Contact Support</a> —
<a href="https://status.github.com">GitHub Status</a> —
<a href="https://twitter.com/githubstatus">@githubstatus</a>
</div>
Since you have two-factor authentication enabled, you will need to send a special HTTP header: