Pull git reposetory on remote server

pip install flask

Create remotepull.py:

from flask import Flask
import subprocess
app = Flask(__name__)

def main():
        output = subprocess.check_output(["git", "pull"])
        return output
    except subprocess.CalledProcessError as exc:
        return "Status : FAIL errcode: {}, output: {}".format(exc.returncode, exc.output)
app.run(host="", port=int("8080"))

GO to server with ssh, change dir to your repo

nohup python remotepull.py &

You can disconnect from ssh. Puller will remain active until OS restart. You can create some init/systemd script for autostart.
In browser go to http://your_server_ip/domain:8080/pullstaging
If you want version with authorization, see this tip

#git #flask
Ivan Borshchov profile picture
May 05, 2017
by Ivan Borshchov
Did it help you?
Yes !

Best related