0

使用 pygit2 推送时遇到问题v0.21.3。这是我的代码:

import pygit2 as git
repo = git.Repository("path/to/my/repo.git") # just for testing,it will not be local

for rem in repo.remotes:
    rem.push_url = rem.url
    rem.credentials = git.UserPass("user","passowrd")
    sig = git.Signature("user","user@example.com")

    rem.push('refs/heads/master',signature=sig)
    # in v0.22.0 it will be like below
    # rem.push(['refs/heads/master'],signature=sig)

但是,我总是收到这条消息:

Traceback (most recent call last):
  File "C:\test.py", line 9, in <module>
    rem.push('refs/heads/master',signature=sig)
  File "C:\Python34\lib\site-packages\pygit2-0.21.3-py3.4-win32.egg\pygit2\remote.py",line 353, in push
    err = C.git_push_update_tips(push, ptr, to_bytes(message))
TypeError: initializer for ctype 'git_signature *' must be a cdata pointer, not bytes

当我尝试使用版本0.22.0时,它没有引发错误,但推送操作也不起作用。

注意:我认为签名参数的问题,因为当我通过None默认签名时它可以正常工作。

谢谢。

4

1 回答 1

0

我已将 pygit2 更新为v0.22.1,将 libgit2 更新为v0.22.3,它解决了问题。

于 2015-07-27T06:38:46.077 回答