How to clone from specific branch from Git using Gitpython

前端 未结 2 1966
温柔的废话
温柔的废话 2021-01-05 19:06

I tried to clone a repository from git using GitPython in python function. I used GitPython library for cloning from git in my python function and my code snippet as follows

2条回答
  •  执念已碎
    2021-01-05 19:21

    just pass the branch name parameter, e.g. :-

    repo = Repo.clone_from(
        'http://user:password@github.com/user/project.git',
        '/home/antro/Project/',
        branch='master'
    )
    

    see here for more info

提交回复
热议问题