我在Python中使用此代码(使用“import git”):
repo = git.Repo("my_repository")repo.git.add("bla.txt")repo.git.commit("my commit description")
现在我想推动这个提交.我已经尝试了很多但没有成功. Python命令应该与此Bash命令类似:
git push origin head:refs/for/master
最佳答案您可以尝试以下方法.它可能会解决您的问题……repo.git.pull('origin',new_branch)repo.git.push('origin',new_branch)
总结 以上是内存溢出为你收集整理的Git通过GitPython推送全部内容,希望文章能够帮你解决Git通过GitPython推送所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)