Skip to content

Instantly share code, notes, and snippets.

@ashrithr
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashrithr/9256882 to your computer and use it in GitHub Desktop.
Save ashrithr/9256882 to your computer and use it in GitHub Desktop.
rsync using ssh protocol and exclude flag
rsync -rav -e 'ssh -i /Users/ashrith/.ssh/aws.pem' --exclude=".git/*" ${SOURCE_PATH} root@${HOST}:${PATH}
# Copying to remote server with out root user:
# for this command to work make sure the 'Defaults requiretty' is commented on the remote server in '/etc/sudoers' file
rsync -rav -e 'ssh -i /root/to/key' --rsync-path="sudo rsync" /path/to/copy/* rsyncuser@${HOST}:/dest/path/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment