linkedlist:

Deploy Static Websites with rsync

#4 · · rsync

rsync is a command line utility to transfer files between two directories or even devices. It can also be used to deploy a static website to a remote server. A basic example looks like the following.

rsync --delete -avz local-directory/ USERNAME@HOST:/remote-directory

If you are on a Mac, you might want to avoid transferring those nasty ".DS_Store" files. Or maybe you want to exclude some other files. You can use the --exclude arg for that. If needed, you can also tell rsync to use an alternative remote shell instead of the default ssh. Or you can use it to specify a different port number.

rsync --exclude=".DS_Store" --delete -avz -e "ssh -p1234" local-directory/ USERNAME@HOST:/remote-directory

See explainshell for details on what exactly all these args are for.