title: Jenkins won't use SSH key
body: <p>I'm sorry to have to ask this question, but I feel like I've tried every answer so far on SO with no luck.</p>
  
  <p>I have my local machine and my remote server.  Jenkins is up and running on my server.</p>
  
  <p>If I open up terminal and do something like <code>scp /path/to/file user@server:/path/to/wherever</code> then my ssh works fine without requiring a password</p>
  
  <p>If I run this command inside of my Jenkins job I get '<code>Host Key Verification Failed</code>'</p>
  
  <p>So I know my SSH is working correctly the way I want, but why can't I get Jenkins to use this SSH key?</p>
  
  <p>Interesting thing is, it did work fine when I first set up Jenkins and the key, then I think I restarted my local machine, or restarted Jenkins, then it stopped working.  It's hard to say exactly what caused it.  </p>
  
  <p>I've also tried several options regarding ssh-agent and ssh-add but those don't seem to work.</p>
  
  <p>I verified the local machine .pub is on the server in the /user/.ssh folder and is also in the authorized keys file.  The folder is owned by user.</p>
  
  <p>Any thoughts would be much appreciated and I can provide more info about my problem.  Thanks!</p>
  
  <p>Update:</p>
  
  <p>Per Kensters suggestion I did <code>su - jenkins</code>, then <code>ssh server</code>, and it asked me to add to known hosts.  So I thought this was a step in the right direction.  But the same problem persisted afterward.</p>
  
  <p>Something I did not notice before I can <code>ssh server</code> without password when using my <code>myUsername</code> account.  But if I switch to the <code>jenkins</code> user, then it asks me for my password when I do <code>ssh server</code>.</p>
  
  <p>I also tried <code>ssh-keygen -R server</code> as suggested to no avail.</p>