I have my development machine where I develop the code, my server machine where I host it and my central git repo machine.
From my development machine, how can I push and get both the central repo and the server machine updated automatically?
Should I push to server and have a server post action to push to server and if so, how do I do this?
Since there are no built in “post-push” hooks for git, an easy way to accomplish that would be to designate a certain branch as ‘production’ branch (typically master branch is used for that purpose) and then create a deployment script (say
git-deploy.sh) which would pull the most recent code from master branch on your server. Then, you could create a git alias like this:which you can then run it by using