我正在尝试使用git python添加、提交和推送到存储库。根据不完整的文档和示例here,我尝试了以下方法:
myrepo = Repo('Repos/hello-world/.git')
# make changes to README.md
myrepo.index.add('README.md')
myrepo.index.commit("Updating copyright year")
myrepo.git.push("origin", "copyright_updater") ###
我签出了存储库hello_world
,并将其放在一个文件夹Repos
下。我确实更改了一个文件README.md
。但是有了这个代码,我得到了一个错误
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
cmdline: git push origin copyright_updater
stderr: 'error: src refspec copyright_updater does not match any.
error: failed to push some refs to 'git@github.com:alex4200/hello-world.git''
在标记行中
如何修复它,以便将更改推送到新分支并在GitHub上创建拉请求
您需要做的是直接使用
git
。这在gitpython教程的末尾解释基本上,当您有一个
repo
对象时,您可以像例如,调用git命令
是吗
适用有关“-”的特殊规则
因此,为了创建一个新分支并将其推送到github,完整的序列变得
如何在github上为新分支创建拉取请求,是我还没有掌握的一些不同的魔法
相关问题 更多 >
编程相关推荐