Skip to content
Advertisement

How can I call ‘git pull’ from within Python?

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 gets any changes that need to be made. However, I can’t figure out how to call that function from within Python. I have tried the following:

JavaScript

But this results in the following error

JavaScript

Is there a way that I can call this bash command from within Python?

Advertisement

Answer

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

JavaScript

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

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement