【发布时间】:2014-07-03 17:03:08
【问题描述】:
我正在尝试使用 ssh 推送到使用 pygit2 的 github 存储库。
这是我不断收到的错误。
你能指出错误吗?
>>> sshcred = repo_.pygit2.credentials.Keypair('avckp','id_rsa.pub','id_rsa','')
>>> remo2.credentials=sshcred
## remo2 is a remote object for the repo
>>> remo2.url
u'https://github.com/avckp/sansa-pygit.git'
>>> remo2.push_url = remo2.url
>>> remo2.push('refs/heads/master')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "pygit2/remote.py", line 301, in push
check_error(err)
File "pygit2/errors.py", line 57, in check_error
raise GitError(message)
GitError: HTTP parser error: the on_headers_complete callback failed
【问题讨论】:
-
为什么要给自己分配
remo2.push_url? -
这是一个错字。它是 remo2.push_url = remo2.url
-
感谢您的指出。刚刚做了。
-
你不是通过 ssh 推送,而是通过 HTTP 推送。
-
这是一些 ssh url 开始的一种方式,但您只需要查看架构,它应该是
ssh://(或使用 scp 样式的user@host:path)。此外,尝试使用avckp向 GitHub 进行身份验证不会成功,因为这不是他们拥有的系统用户。您所指的git@部分是用户名,在您的示例中您将使用不可用的用户名覆盖它。