Last active
August 29, 2015 14:08
-
-
Save andre3k1/1a44c8f36808d0ee8fab to your computer and use it in GitHub Desktop.
Push GitHub changes to Apache Web Server
This file contains 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 | |
# | |
# This "post-receive" script receives from stdin three arguments in the form: | |
# <oldrev> <newrev> <refname> | |
# | |
while read oldrev newrev ref | |
do | |
branch=`echo $ref | cut -d/ -f3` | |
if [ "master" == "$branch" ]; then | |
git --work-tree=/var/www/default/public_html/ checkout -f $branch | |
echo 'GitHub changes pushed to production.' | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment