【发布时间】: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