Skip to content

Instantly share code, notes, and snippets.

Last active Dec 24, 2015
What would you like to do?
Easy peezy deploy from a git repo using rsync
# heavily inspired by (and comments)
ref=master # git ref
prefix=deploy_in_prog/ # just a temp name
remote_dir=/var/www # the remote directory
remote_host=user@host # the remote host
echo "Deploying to $remote_dir..."
git archive --prefix=$prefix $ref | tar -x -C $tmp_dir | rsync $tmp_dir/$prefix --copy-links -av $remote_host:$remote_dir
rm -rf $tmp_dir/$prefix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment