Created
March 30, 2012 14:35
-
-
Save thirdknife/2251963 to your computer and use it in GitHub Desktop.
My pre-receive hook to update my website when I "git push origin master:live"
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/sh | |
while read old new branch | |
do | |
case "$new-$branch" in | |
000000000000000000*) | |
: echo "ignore deleted" | |
;; | |
*-refs/heads/live ) | |
echo "UPDATING LIVE SITE"; | |
git archive $new | ( | |
mkdir /tmp/XX.$$ | |
cd /tmp/XX.$$ || exit 1 | |
umask 022 | |
tar xf - | |
rsync --delete -rlpgocv lib/ /web/geekcruises-secure/lib-ng/ | |
cd /tmp || exit 1 | |
rm -rf XX.$$ | |
) | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment