Deploying Your Site

There are several tools to help developers deploy changes to their site…that is if they manage their own server. With Rails, maybe the most popular gem is Capistrano. With it, all you do is type

cap deploy

into the terminal and hit enter. It sends only the files that have been updated since your latest Git commit. It’s fantastic and very easy to use once you’ve set it up. If you use Heroku, they have their own CLI (Command Line Interface) with tools to do the exact same thing. Once installed and set up, all you need to type in terminal is

git push heroku master

If you are not using anything like this, you are most likely using…

FTP For Deployment

When you DON’T manage your own server, and pay for managed hosting (with say, Mediatemple, Bluehost, Dreamhost, etc), then you likely don’t have access to such tools. You are probably restricted to FTP when it comes to deploying, and FTP sucks. It really does.

Some editors, like Coda, have tried to alleviate this by buiding an FTP client within the editor. But then you are stuck with their editor and their environment, and you also have to pay $75. If neither of those sound like a good option, then it turns out there are some amazing and free tools to help you out. Two such tools are PHPloy and git-ftp, but I will only talk about git-ftp here. If you are familiar with or use Grunt, it does this as well, but way more clunkily. It uploads your entire site, regardless of what files you updated. “Oh, just corrected a typo? Well we’ll just upload all 800+ files anyway just to be sure.”

This all assumes you already use Git to version control all your projects because Git is awesome and is infinitely helpful. So if you aren’t doing that already, take your workflow to the next level and GIT ON THAT. Don’t like the terminal for Git? Cool, I personally use Tower, but Github has it’s own free client: Github for Mac. I will go over how to install git later on, however, you should check the interwebs on how to use it. It’s another tutorial in itself.

Installing Git-Ftp

Using this thing is dead simple, but requires us to use some things a lot of front-end developers may not use. It’s worth it, so we’ll just have to get over it. Time to fire up terminal! First thing is first, and the easiest way to get this done is install Homebrew. This should only need one line of code to do this and that’s

ruby -e "$(curl -fsSL"

Copy and paste that in terminal and hit enter. You may have to install Xcode too. I know this is all a pain, but you only have to do it once and Homebrew is very powerful and useful tool to have anyway. I won’t go into much more detail about it, but there is plenty of documentation out there, it’s very popular.

Once installed, run:

brew update


brew doctor

It will probably say you’re good to go. If so then all we need to do to install git-ftp is this:

# brew install git
# brew install curl --with-ssl --with-ssh
# brew install git-ftp

Note, if you already have git installed, ignore that first line. Git-ftp should now be installed! Give yourself a hearty pat on the back because you’re pretty much almost done.

Now How Do I Use This Thing?

Ok, let’s get to it. With terminal still open, type “cd” (this stands for change directory). We are going to naviage to your project folder. There are ways to do this in terminal but the easiest method to explain in this tutorial is just to open up finder, locate your project folder and drag and drop it into the terminal window. So your line should now read:

cd /mycomputer/sites/myprojectfolderpath

Hit enter, and now type out this line, filled in with your own info of course:

git ftp init -u <user> -p -

Remember not to just paste your ftp url. You need to include the subdirectories all the way down to your public folder. This may be “” or something. After that hit enter, you will be prompted for your password. You won’t see any dots or characters when you type though, for security reasons. Just type it out normally and hit enter. That should do your initial commit, uploading your site to your server. Depending on the size, this could take a while (wordpress has TONS of files).

For every other deployment after that you can use this line:

git ftp push --user <user> --passwd <password>

It will only upload the files you changed. Easy peazy.

And that’s it! This is probably longer than it should be, but once you’ve finished, you will see it wasn’t so bad and you will want to use this for every project ever. Drag and drop ftp is the worst and should die a fiery death.

Advanced Usage

If all of that above was a piece of cake, maybe you’d be interested in some more advanced features. All of them can be found here, but they include saving your info so you don’t have to repaste it every time, also having multiple credentials, and ignoring files.