python调用git下载_如何使用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.de
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()
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)