Skip to content

Instantly share code, notes, and snippets.

@ajford
Created October 26, 2012 03:41
Show Gist options
  • Save ajford/3956737 to your computer and use it in GitHub Desktop.
Save ajford/3956737 to your computer and use it in GitHub Desktop.
Static site deployment via git post-receive hook
#!/bin/sh
# Deploy hook for static sites (or similar application).
#
# Written by Anthony Ford <ford.anthonyj@gmail.com>
#
# Essentially clones the repo into a directory then removes
# the git related files.
REPO_DIR=`pwd`
DEPLOY_DIR='/tmp/deploy'
echo "Deploy Dir: "$DEPLOY_DIR
if [ ! -e $DEPLOY_DIR ]; then
mkdir $DEPLOY_DIR
fi
git clone $REPO_DIR $DEPLOY_DIR
rm -rf $DEPLOY_DIR/.git
echo "Done Deploying"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment