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
o.pull()
o.push()
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? Thanks.
I managed this by getting the repo name directly:
repo = git.Repo('repo_name')
o = repo.remotes.origin
o.pull()