Skip to content

Instantly share code, notes, and snippets.

@ronaldoedy
Forked from jsborjesson/rsync-deploy.sh
Created June 12, 2017 13:49
Show Gist options
  • Save ronaldoedy/5acb9463c36bb5f26879480fdaf6e1fb to your computer and use it in GitHub Desktop.
Save ronaldoedy/5acb9463c36bb5f26879480fdaf6e1fb to your computer and use it in GitHub Desktop.
Deploying a folder via rsync over ssh. This is for deployments from OSX to Linux servers.
#!/bin/bash
# You might have to install a new version of rsync for this to work.
# This is easily done by `brew install rsync` and restarting your terminal.
# To use a file as an exclude-list you can use the option
# --exclude-from='donot-deploy.txt'
# Change these to match your settings
USER_NAME='username'
HOST_NAME='hostname'
LOCAL_PATH='app/'
REMOTE_PATH='public_html/'
# The --iconv is for avoiding problems with case insensitive OSX-file systems
# The first parameter-list is in order: recursive, preserve links, preserve timestamps, compress, skip newer files, verbose
rsync \
-rltzuv --progress --iconv=UTF8-MAC,UTF-8 --delete \
--exclude='.DS_Store' \
--exclude='.git/' \
-e ssh $LOCAL_PATH $USER_NAME@$HOST_NAME:$REMOTE_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment