【发布时间】:2015-03-01 02:21:40
【问题描述】:
我在使用 curl 在我的 GitHub.com 帐户(无 ssh)上创建存储库时遇到问题。
我使用 Jekyll 创建了一个基本的静态本地站点,我想将其推送到 GitHub.com 存储库(我想在 <username>.github.io 上托管该站点,并且根据 GitHub 页面上的说明,存储库必须具有与包含本地站点的文件夹同名。
我为 GitHub 登录启用了双重身份验证,因此在 this post 之后,我传递了一个 OTP/令牌(使用选项 -H "X-GitHub-OTP":<token> 在请求标头中的 Applications settings 上生成。我可以登录(这个之前的帖子提出了一个关于 Github 登录不起作用的问题,这是由于没有正确关闭字符串 "X-GitHub-OTP"),但现在登录有效,但我现在收到带有 400 代码的响应。这是我的 curl 命令我用过:
$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
以及响应消息:
<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>
【问题讨论】: