Skip to content

Instantly share code, notes, and snippets.

@vangberg
Created April 2, 2011 02:18
Show Gist options
  • Save vangberg/899175 to your computer and use it in GitHub Desktop.
Save vangberg/899175 to your computer and use it in GitHub Desktop.
post-receive.sh
#!/usr/bin/env bash
set -m
[ -f post-receive.pid ] && kill `cat post-receive.pid` &>/dev/null
echo $$ > post-receive.pid
trap 'kill %%; exit 1' EXIT
while true
do
echo "Waiting for request."
echo -ne "HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nOK" \
| nc -l 3000 -q -1 \
| grep "APIKEY" \
&& git fetch \
&& git reset --hard origin/master
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment