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/ && cd ~/www/
git init

Next, let's set up your server's git repo to nicely handle deployment via git push.

git config core.worktree ~/www/
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
git checkout -f
chmod +x .git/hooks/post-receive

Back on your local machine, let's get your git repo ready for deployment.

cd ~/www-dev/
git remote add origin \

Now, whenever you want to deploy changes you've made locally, simply run the following command!

git push