Last active
December 28, 2015 06:39
-
-
Save tonicospinelli/7459150 to your computer and use it in GitHub Desktop.
Git Hook Post Receive - simple deploy for main branches into differents pathsThanks #ekynoxe for your explanationshttp://blog.ekynoxe.com/2011/10/22/automated-deployment-on-remote-server-with-git/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| livepath="/path/www/master.dev" | |
| devpath="/var/www/develop.dev" | |
| while read oldrev newrev ref | |
| do | |
| branch=`echo $ref | cut -d/ -f3` | |
| if [ "master" == "$branch" ]; then | |
| git --work-tree=$livepath checkout -f $branch | |
| echo $livepath | |
| echo 'Changes pushed live.' | |
| elif [ "develop" == "$branch" ]; then | |
| git --work-tree=$devpath checkout -f $branch | |
| echo $devpath | |
| echo 'Changes pushed to dev.' | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment