'Automatically update local github repository on master branch change
I have a github repository that exists on several different hosts. I'm trying to figure out if there's some way to have two of the hosts automatically pull down any new changes to the master branch, without having to log in and issue the pull commands themselves, at the same time I still need to be able to push changes from those hosts on rare occasions.
From what I've seen I believe I should be looking at something with Hooks, but having a hard time understanding how they work. It seems like a server side post-receive may be what I'm looking for, but not sure.
Does anyone have any experience with getting this to work?
Solution 1:[1]
I had the same issue and created a python script with simple http.server routine. Here the repository (only built-in libraries): https://github.com/TinKurbatoff/github-webhook-autopull
Here you may setup a webhook:
https://github.com/<github_user_name>/<your_repo>/settings/hooks
and it will call your web server each time this repo is updated.
Even if you keep your repo copy locally — you may set this listener up at your home/work computer on some port and call your computer via IP (you may need to set up a port forwarding at the home router).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Constantine Kurbatov |
