public
Last active

My pre-receive hook to update my website when I "git push origin master:live"

  • Download Gist
pre-receive.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.