title: Remote Git pull using ssh results in Permission denied (publickey)?
body: <p>I have a git repository in a hosted instance of Atlassian Stash. I then have three machines: olympus, zeus and hera where I deploy the latest release of a software system. To automate this I'd like to remotely deploy from olympus onto the other machines which I try to do using <code>ssh</code> and <code>git pull</code> but this fails with <code>Permission denied (publickey).</code>. I basically do and get:</p>
  
  <pre><code>azg@olympus:~$ ssh azg@zeus 'cd ~/my/project/release/deploy/location/; git pull'
  Permission denied (publickey).
  fatal: The remote end hung up unexpectedly
  </code></pre>
  
  <p>I have the following:</p>
  
  <ul>
  <li>Every machine has a different azg user (haven't had time to install LDAP etc) so I have azg@olympus, azg@zeus and azg@hera. For each user I have generated ssh id_rsa key pairs. </li>
  <li>I have populated each azg user <code>authorized_keys</code> with the corresponding id_rsa.pub of the others</li>
  <li><p>Stash azg user is configured with a copy of all id_rsa.pub for every azg user (azg@olympus, azg@zeus, azg@hera) so I can clone, pull or push from every machine via ssh without having to enter password each time. Therefore I can do no problems:</p>
  
  <pre><code>azg@olympus:~/code$ git clone ssh://azg@olympus:7999/pm/pm.git
  Cloning into 'pm'...        
  remote: Counting objects: 555, done.
  remote: Compressing objects: 100% (271/271), done.
  remote: Total 555 (delta 203), reused 555 (delta 203)
  Receiving objects: 100% (555/555), 9.54 MiB, done.
  Resolving deltas: 100% (203/203), done.
  </code></pre></li>
  </ul>
  
  <p>and I can do the same from each machine separately. However, I can't do it if I login remotely first namely it asks me each time for the passphrase for key '/home/azg/.ssh/id_rsa' e.g.</p>
  
  <pre><code>azg@olympus:~$ ssh azg@zeus
  Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.5.0-43-generic x86_64)
  
   * Documentation:  https://help.ubuntu.com/
  
  Last login: Wed Nov 27 17:01:33 2013 from olympus
  azg@zeus:~$ cdc
  azg@zeus:~/code$ git clone ssh://azg@olympus:7999/pm/pm.git
  Cloning into 'pm'...
  Enter passphrase for key '/home/azg/.ssh/id_rsa':  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; WHY???
  remote: Counting objects: 555, done.
  remote: Compressing objects: 100% (271/271), done.
  remote: Total 555 (delta 203), reused 555 (delta 203)
  Receiving objects: 100% (555/555), 9.54 MiB | 145 KiB/s, done.
  Resolving deltas: 100% (203/203), done.
  </code></pre>