How can I call 'git pull' from within Python?

前端 未结 6 1603
栀梦
栀梦 2020-12-07 18:11

Using the github webhooks, I would like to be able to pull any changes to a remote development server. At the moment, when in the appropriate directory, git pull

6条回答
  •  悲&欢浪女
    2020-12-07 18:44

    Have you considered using GitPython? It's designed to handle all this nonsense for you.

    import git 
    
    g = git.cmd.Git(git_dir)
    g.pull()
    

    https://github.com/gitpython-developers/GitPython

提交回复
热议问题