Skip to content

Instantly share code, notes, and snippets.

@arangates
Created November 3, 2016 05:37
Show Gist options
  • Save arangates/7c104798399d65cb34c41d31e911920c to your computer and use it in GitHub Desktop.
Save arangates/7c104798399d65cb34c41d31e911920c 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