Created
November 27, 2018 02:35
-
-
Save abelcallejo/df1f910315df31bc1e343008d36b9fb7 to your computer and use it in GitHub Desktop.
Git hook post-receive template
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 | |
while read oldrev newrev ref | |
do | |
branch=`echo $ref | cut -d/ -f3` | |
if [ "master" == "$branch" ]; then | |
WORKTREE=/var/www/html/app/ | |
git --work-tree=$WORKTREE checkout -f $branch | |
echo "Changes were successfully pushed to staging server at location $WORKTREE" | |
find $WORKTREE -iname "*.php" | xargs chmod 665 | |
find $WORKTREE* -type d | xargs chmod 775 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment