title: SSH agent forwarding with Capistrano 3 not working when deploying Rails app
body: <p>I have the following setup in my deploy.rb</p>
  
  <pre><code>set :application, 'sample_app'
  set :repo_url, 'user@123.45.67.100:/home/user/railsapps/sample_app'
  set :deploy_to, '/var/www/sample_app'
  set :user, "user"
  set :ssh_options, { :forward_agent =&gt; true }
  </code></pre>
  
  <p>and my deploy/production.rb file:</p>
  
  <pre><code>set :stage, :production
  server '123.45.67.200', user: 'user', roles: %w{app db web}
  </code></pre>
  
  <p>I get the following error when I run cap production deploy:check</p>
  
  <pre><code>DEBUG [] ssh: connect to host 123.45.67.100 port 22: Connection timed out
  DEBUG [] fatal: Could not read from remote repository.
  Please make sure you have the correct access rights and the repository exists.
  (Backtrace restricted to imported tasks)
  cap aborted!
  SSHKit::Runner::ExecuteError: Exception while executing as user@123.45.67.200: git exit status: 128
  git stdout: Nothing written
  git stderr: ssh: connect to host 123.45.67.200 port 22: Connection timed out
  fatal: Could not read from remote repository.
  Please make sure you have the correct access rights and the repository exists.
  </code></pre>
  
  <p>In one of the lines, I see that it tries to access the repository as user@123.45.67.200, which is the deployment user for the production server:</p>
  
  <pre><code>INFO [] Running /usr/bin/env git ls-remote --heads user@123.45.67.100:/home/user/railsapps/sample_app as user@123.45.67.200
  </code></pre>
  
  <p>Shouldn't it be saying that it's connecting as the local user with the local ssh keys? Is Capistrano logging into the production server and then pulling code from the repository? If it is, is there a way to make it push code from the repository to the production server?</p>