FTP is so 90's. Let's deploy via Git instead!
First, create a directory on your server and initialize an empty git repository. I like to serve my websites from
~/www/, so that's what I'll do in this example.
mkdir ~/www/example.com && cd ~/www/example.com git init
Next, let's set up your server's git repo to nicely handle deployment via
git config core.worktree ~/www/example.com git config receive.denycurrentbranch ignore
Finally, we'll set up a post-receive hook for git to check out the
master branch so your web server can serve files from that branch. (Remember,
^D is Control+D, or whatever your shell's EOT character is.
cat > .git/hooks/post-receive #!/bin/sh git checkout -f ^D chmod +x .git/hooks/post-receive
Back on your local machine, let's get your git repo ready for deployment.
cd ~/www-dev/example.com git remote add origin \ ssh://firstname.lastname@example.org/home/user/www/example.com
Now, whenever you want to deploy changes you've made locally, simply run the following command!