【问题标题】:An error in signature when pushing using pygi2使用 pygi2 推送时出现签名错误
【发布时间】:2015-07-07 11:54:19
【问题描述】:

我在使用 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 时,默认签名可以正常工作。

谢谢。

【问题讨论】:

    标签: python python-3.x libgit2 pygit2


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-16
      • 2015-07-05
      • 1970-01-01
      • 2012-06-12
      • 1970-01-01
      • 2012-10-29
      • 2016-12-30
      • 2011-10-27
      相关资源
      最近更新 更多