Last active
May 17, 2016 20:04
-
-
Save a7madgamal/00f40d6b248991abf116cff916e5a52c to your computer and use it in GitHub Desktop.
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
#create hook script: /path/to/git/bare/repo/post-receive | |
#!/bin/bash | |
while read oldrev newrev ref | |
do | |
if [[ $ref =~ .*/master$ ]]; | |
then | |
echo "pulling master" | |
git --work-tree=/path/to/working/dir --git-dir=/path/to/working/dir/.git pull origin master | |
else | |
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server." | |
fi | |
done | |
# then run this to make it executable | |
chmod +x post-receive | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment