Skip to content

Instantly share code, notes, and snippets.

@jhofker
Last active August 29, 2015 14:15
Show Gist options
  • Save jhofker/5b397e2eaebf9185477e to your computer and use it in GitHub Desktop.
Save jhofker/5b397e2eaebf9185477e to your computer and use it in GitHub Desktop.
post-receive hook to pull another repo on the server
#!/bin/sh
PUBLIC_WWW=/home/public
GIT_DIR=$PUBLIC_WWW/.git
# Pull the latest from the repo to the public dir.
cd $PUBLIC_WWW
echo Pulling.
git reset HEAD --hard
git pull
echo Setting permissions.
chmod 755 *
exit
@jhofker
Copy link
Author

jhofker commented Feb 22, 2015

Resources that were helpful (but share none of the blame if I did something stupid):
Major Ursa
torek on StackOverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment