Last Updated: February 25, 2016
· hupili

Use Git to deploy changes to web servers

Suppose you have {HOME}/html as the web root and {HOME}/html.git as a corresponding bare repo. Now edit {HOME}/html.git/hooks/post-update as

cd $target
unset GIT_DIR
git pull


Now you can work in your local Git repo, whose remote is user@remote_machine:{HOME}/html.git. After any modification, commit it and fire a git push. Your remote website is update!

This is what I do on the GoDaddy server ( http://hupili.net/ ).

More details: https://gist.github.com/hupili/7767420