Skip to content

Instantly share code, notes, and snippets.

@thirdknife
Created March 30, 2012 14:35
Show Gist options
  • Save thirdknife/2251963 to your computer and use it in GitHub Desktop.
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"
#!/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