Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myersg86/0e601e38d2149e24aa0e42e56b9f94a2 to your computer and use it in GitHub Desktop.
Save myersg86/0e601e38d2149e24aa0e42e56b9f94a2 to your computer and use it in GitHub Desktop.
!/bin/bash
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=/var/www/html/testing/ --git-dir=/var/www/repo/testing.git/ checkout -f
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment