Last active
October 19, 2015 21:09
-
-
Save abdel/bf8fbcfdc8a6f290dadb to your computer and use it in GitHub Desktop.
Automatic Git Deployment
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 | |
# Hook Setup | |
source $(dirname $0)/hook-setup | |
while read oldrev newrev ref | |
do | |
if [[ $ref =~ .*/master ]]; | |
then | |
echo "Ref $ref successfully received. Deploying to $PROJECT_DIR..." | |
git --work-tree=/var/www/$PROJECT --git-dir=/home/git/repositories/$USERNAME/$REPOSITORY checkout -f | |
else | |
echo "Ref $ref successfully received." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment