title: Deploying via Capistrano through Jenkins - SSH authentication failed
body: <p>I've got a Jenkins build that runs a Capistrano deploy as a post-build action.</p>
  
  <p>Running the Capistrano task as the Jenkins user from the console works absolutely fine and without a password prompt (I've previously set up SSH keys on both build and staging server). However, when running the same script through Jenkins, I suddenly get a password prompt and the build subsequently fails (no TTY present).</p>
  
  <pre><code>[workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
  Performing Post build task...
  Match found for : : True
  Logical operation result is TRUE
  Running script  : cap _2.13.4_ deploy
  [workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
  + cap _2.13.4_ deploy
    * executing `deploy'
    * executing `deploy:update'
   ** transaction: start
    * executing `deploy:update_code'
      triggering before callbacks for `deploy:update_code'
  [32m--&gt; Updating code base with checkout strategy[0m
      executing locally: "git ls-remote git@my.staging-server.com:my_project.git master"
      command finished in 1200ms
    * executing "git clone -q git@my.staging-server.com:my_project.git /var/www/staging/my_project/releases/20121029223619 &amp;&amp; cd /var/www/staging/my_project/releases/20121029223619 &amp;&amp; git checkout -q -b deploy 1fb11d669a6cb5a714d077162305dfcfaba82f01 &amp;&amp; (echo 1fb11d669a6cb5a714d077162305dfcfaba82f01 &gt; /var/www/staging/my_project/releases/20121029223619/REVISION)"
  servers: ["my.staging-server.com"]
  Password: stty: standard input: Inappropriate ioctl for device
  stty: standard input: Inappropriate ioctl for device
  stty: standard input: Inappropriate ioctl for device
  
  *** [deploy:update_code] rolling back
    * executing "rm -rf /var/www/staging/my_project/releases/20121029223619; true"
      servers: ["my.staging-server.com"]
   ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
  connection failed for: my.staging-server.com (Net::SSH::AuthenticationFailed: not-specified)
  POST BUILD TASK : FAILURE
  </code></pre>
  
  <p>It looks like Ruby doesn't pick my SSH key up when running through Jenkins perhaps (<code>Net::SSH::AuthenticationFailed: not-specified</code>)?</p>
  
  <p>Does anyone have an idea what might be going wrong here?</p>