Skip to content

Instantly share code, notes, and snippets.

@andre3k1
Last active August 29, 2015 14:08
Show Gist options
  • Save andre3k1/1a44c8f36808d0ee8fab to your computer and use it in GitHub Desktop.
Save andre3k1/1a44c8f36808d0ee8fab to your computer and use it in GitHub Desktop.
Push GitHub changes to Apache Web Server
#!/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