Capistrano has the option to forward the local SSH agent to the remote server it wants to deploy on. But for this to work a SSH agent must be running and the key(s) you want to forward must be added to that SSH agent.

First I tried to start the SSH agent with the Capistrano deploy.rb recipe, but I could not get that to work and also the killing of the SSH agent afterwards could be a problem.

Eventually I solved it by adding the following line to the crontab of the deploy user. This line will be executed More >