Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Post-Receive hook. Runs when the repository is pushed to.
#!/bin/bash
while read oldrev newrev refname
do
if [ "$refname" == "refs/heads/master" ]; then
WORKDIR=/path/to/local/repo
export GIT_DIR=$WORKDIR/.git
pushd $WORKDIR >/dev/null
git pull --quiet >/dev/null
# run some code
popd >/dev/null
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment