在推动使用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时,它没有引发错误,但是push操作也不起作用。
注意事项:我认为签名参数的问题,因为当我传递None时,它在默认签名中工作得很好。
谢谢。
发布于 2015-07-27 06:38:46
我已经将pygit2更新为v0.22.1,libgit2更新为v0.22.3,它解决了问题。
https://stackoverflow.com/questions/31267870
复制相似问题