Skip to content

Instantly share code, notes, and snippets.

@rpetre
Created October 22, 2012 09:52
Show Gist options
  • Select an option

  • Save rpetre/3930697 to your computer and use it in GitHub Desktop.

Select an option

Save rpetre/3930697 to your computer and use it in GitHub Desktop.
post-receive hook for cfengine deployment
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "prod" == "$branch" ]; then
git --work-tree=/var/cfengine/masterfiles checkout -f $branch
echo 'Changes pushed live.'
fi
if [ "test" == "$branch" ]; then
git --work-tree=/var/cfengine/testfiles checkout -f $branch
echo 'Changes pushed to test.'
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment