I must have lost about six or seven hours trying to get a Rails application deploying from Git in the past week. I could push and pull from the repository, but could I get the thing to deploy via Capistrano? No, I could not.

The problem, as far as I could tell, was not with Capistrano. It was a simple SSH problem. I block port 22 for SSH on the server in question, for security reasons, and use a different port. But, no matter how I specified it, Git was insistent on trying to pull over 22. I did a lot of Googling, and found lots of conflicting answers, none of which worked.

And then I learned my lesson. That lesson is: when Linus tells you what to do, you do it:

Use the “.ssh/config” file ;)

So I configured a hostname in .ssh/config on the server, and everything worked instantly.

A lot of problems tend to come down to SSH, it seems. After that point, everything went swimmingly.