我正在尝试自动化一个更改过程,该过程当前创建手动推送到 Git 的源代码。我正在尝试使用GitPython包装该代码:
from git import *
# create the local repo
repo = Repo.init("/tmp/test/repo", bare=True)
assert repo.bare == True
# check status of active branch
repo.is_dirty()
# clone the remote repo
remote_repo = repo.clone("http://user:pass@git/repo.git")
# compile source code into repository
# ...
# track untracked files
repo.untracked_files
# commit changes locally
repo.commit("commit changes")
# push changes to master
remote_repo.push()
当我尝试运行它时,我得到
回溯(最近一次通话最后):
文件“git_test2.py”,第 33 行,在
repo.commit("提交更改")
坏对象:636f6d6d6974206368616e676573
该脚本能够拉取远程存储库,但在提交时失败。有更好的方法吗?