May 26, 2008

Using SSH key authentication in Capistrano

This just took me 15 minutes too long to figure out, so here’s how to do it.


set :ssh_options, :keys => '/full/path/to/id_rsa'

Put it in ~/.caprc if you have any other developers on the project so they can set up their own stuff.

Capistrano passes :ssh_options nearly verbatim to Net::SSH. So if you need reference on other possible options, check out docs for Net::SSH.start.