Skip to content

Instantly share code, notes, and snippets.

@micahwalter
Created May 14, 2015 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micahwalter/d683f3e87543a074eb9a to your computer and use it in GitHub Desktop.
Save micahwalter/d683f3e87543a074eb9a to your computer and use it in GitHub Desktop.
post receive deploy hook
#!/bin/sh
# Check out the code on this server.
GIT_WORK_TREE=/home/git/working/<username>/<projectname> git checkout -f
# Define an array of servers to which the code will be deployed.
SERVERS="abc.example.com, xyz.example.com"
# Push codebase to the servers via rsync.
for SERVER in $SERVERS
do
/usr/bin/rsync -av --delete --exclude file-to-exclude.txt -e ssh /home/git/working/<username>/<projectname> username@$SERVER:/<target>/<folder>
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment