-->

无法SSH方式pygit2推(Unable to ssh push in pygit2)

2019-10-20 09:28发布

我试图使用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

Answer 1:

在密钥对用户名应该是“混帐”,如#428说。

它应该是:

sshcred = repo_.pygit2.credentials.Keypair('git','/path/to/id_rsa.pub','/path/to/id_rsa','')
remo.crendentals = sshcred

然后再次尝试推。



文章来源: Unable to ssh push in pygit2