How can I pull a remote repository with GitPython?



I am trying to find the way to pull a git repository using gitPython.
So far this is what I have taken from the official docs here.

test_remote = repo.create_remote('test', 'git@server:repo.git')
repo.delete_remote(test_remote) # create and delete remotes
origin = repo.remotes.origin    # get default remote by name
origin.refs                     # local remote references
o = origin.rename('new_origin') # rename remotes
o.fetch()                       # fetch, pull and push from and to the remote

The fact is that I want to access the repo.remotes.origin to do a pull withouth renaming it’s origin (origin.rename)
How can I achieve this?


I managed this by getting the repo name directly:

 repo = git.Repo('repo_path')
 o = repo.remotes.origin

Answered By – Uuid

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More