Last Updated: February 25, 2016
·
1.438K
· 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

target=${HOME}/html
cd $target
unset GIT_DIR
git pull

DONE!

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

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

The website is part of the attack surface, not only the API behind it. Every script, iframe, and tag on a public page is code that did not go through the same review as the backend.

Security insights from Cside