Friday, October 31, 2008

Capistrano Subversion password

Recently I ran into a problem with Capistrano asking for my password when performing a svn+ssh checkout even though I had my SSH keys configured correctly.

Capistrano hits the svn twice when performing a checkout. The first time it queries the most recent revision number and the second time to perform the actual checkout. It was during this second request that I was being asked for my password. After searching for awhile and trying multiple suggestions I finally came across a solution.

In app/config/deploy.rb :

ssh_options[:keys] = ["#{ENV['HOME']}/.ssh/id_rsa"] #Obviously needed
#default_run_options[:pty] = true #Didn't work for me
#ssh_options[:paranoid] = false #Didn't work for me
ssh_options[:forward_agent] = true #Ah hah.. Success!

Basically the ssh_options[:forward_agent] = true option forwards the first authenticated ssh session (the one that queries the revision number) to the second one (the one that performs the checkout).

If you are seeing the same problem this may just be the fix for you are looking for!


Xavier said...

Worked for me too! Thank you.

MickMoose said...

thanks man said...

Thanks, Great work