如何使用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.