无法ssh推入pygit2
我正在尝试使用ssh将其推送到使用pygit2的github repo。 这是我一直得到的错误。 你能指出错误吗无法ssh推入pygit2,git,ssh,libgit2,pygit2,Git,Ssh,Libgit2,Pygit2,我正在尝试使用ssh将其推送到使用pygit2的github repo。 这是我一直得到的错误。 你能指出错误吗 >>> sshcred = repo_.pygit2.credentials.Keypair('avckp','id_rsa.pub','id_rsa','') >>> remo2.credentials=sshcred ## remo2 is a remote object for the repo >>> remo2.url
>>> 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
密钥对中的用户名应该是“git”,如前所述 应该是:
sshcred = repo_.pygit2.credentials.Keypair('git','/path/to/id_rsa.pub','/path/to/id_rsa','')
remo.crendentals = sshcred
然后再次尝试推送。为什么要将remo2.push\u url分配给自身?这是一个输入错误。它是remo2.push_url=remo2.url谢谢您的指点。确实如此。您并不是试图通过ssh推送,而是HTTP。这是一些ssh URL启动的一种方式,但您只需要查看模式,它应该是ssh://或使用scp样式user@host:路径。此外,尝试使用avckp对GitHub进行身份验证是不会成功的,因为他们拥有的不是系统用户。您提到的git@part是用户名,在您的示例中,您将用一个不可用的用户名覆盖它。