title: PHP Github Pull script error 'permission denied (publickey)'
body: <p>I've set up a PHP script to perform a GitHub pull:</p>
  
  <p>This is contained in my Github folder <code>/home/mysite/public_html/github</code></p>
  
  <p><strong><code>github_pull.php</code></strong></p>
  
  <pre><code>&lt;?php
  echo `git pull 2&gt;&amp;1`;
  ?&gt;
  </code></pre>
  
  <p>My server does already have the SSH public key, as if I perform <code>git pull</code> from Terminal:</p>
  
  <pre><code>ssh username@host.com
  cd public_html/github
  git pull
  </code></pre>
  
  <p>This works successfully <em>(however I do have to enter the password for the rsa key first)</em> <strong>Update: password is no longer needed (see comments)</strong></p>
  
  <p>However, when I run <code>github_pull.php</code> I get the following error:
  Permission denied (publickey). fatal: The remote end hung up unexpectedly</p>
  
  <p>The SSH key is contained at <code>/home/mysite/.ssh/id_rsa</code></p>
  
  <p>When I run </p>
  
  <pre><code>&lt;?php echo `whoami`;
  </code></pre>
  
  <p>It outputs <code>mysite</code> </p>