如何使用GitPython推送到远程仓库 [英] How to push to remote repo with GitPython

查看:72
本文介绍了如何使用GitPython推送到远程仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须从一个存储库克隆一组项目,然后将其自动推送到远程存储库.因此,我正在使用python和特定的模块 GitPython .到目前为止,我可以像这样用gitpython克隆项目:

I have to clone a set of projects from one repository and push it then to a remote repository automatically. Therefore i'm using python and the specific module GitPython. Until now i can clone the project with gitpython like this:

def main():
  Repo.clone_from(cloneUrl, localRepoPath)
  # Missing: Push the cloned repo to a remote repo.

我如何使用GitPython将克隆的存储库推送到远程存储库?

How can i use GitPython to push the cloned repo to a remote repo?

推荐答案

全部包含在另请参见推送参考API .如果您为要推送到的遥控器设置跟踪分支,则可以避免使用refspec设置.

see also the push reference API. You can avoid the refspec setting if you set a tracking branch for the remote you want to push to.

这篇关于如何使用GitPython推送到远程仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆