Auto Git Deployment
from this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
#!/bin/bash
DIRNAME=$1
##make git dir and working dir
mkdir /var/repo/$DIRNAME.git
mkdir /var/www/$DIRNAME
#cd into git folder
cd /var/repo/$DIRNAME.git
#now we are in git repo, lets init bare repository
git init --bare
#go to hooks folder and create post-receive file
cd hooks
##create post-receive file
printf "%b\n" "#!/bin/bash" "git --work-tree=/var/www/$DIRNAME --git-dir=/var/repo/$DIRNAME.git checkout -f" > post-receive
chmod +x post-receive
Written by Purwa Astawa
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#