Last active
June 12, 2017 13:49
-
-
Save jsborjesson/6581757 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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