本文介绍了无法在pygit2中推送ssh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用ssh来使用pygit2进行github回购。
这是我收到的错误。

您能指出错误吗?

I am trying to push using ssh to a github repo using pygit2.Here is the error I keep getting.
Can you point out the error?

>>> 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


推荐答案

Keypair中的用户名应该是'git',如

The username in Keypair should be 'git', as #428 said.

应该是:

It should be:

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

然后再试一次。

这篇关于无法在pygit2中推送ssh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 12:36