title: How to use multiple Git SSH keys on Eclipse?
body: <p>I looked several answers and forums for a solution but I could not find a single one that works.</p>
  
  <p>I have this scenario:</p>
  
  <ul>
  <li>Eclipse Luna Service Release 2 (4.4.2)</li>
  <li>Ubuntu 14.04 x64</li>
  <li>Two ssh keys on my <code>~/.ssh</code> folder</li>
  <li>Two bitbucket accounts (one for personal projects and one for enterprise)</li>
  <li>A git repository only accessible with my primary key (~/.ssh/id_rsa)</li>
  <li>A git repository only accessible with my secondary key (~/.ssh/other)</li>
  </ul>
  
  <p>I created a <code>~/.ssh/config</code> file with the contents:</p>
  
  <pre><code>Host bitbucket bitbucket.org
      Hostname bitbucket.org
      IdentityFile ~/.ssh/id_rsa
      IdentityFile ~/.ssh/other
      User git
  </code></pre>
  
  <p>And for the sake of sanity I added the second key using <code>ssh-add</code> as well. Running <code>ssh-add -l</code> lists both keys.</p>
  
  <p>When using the command line, all git commands work like a charm, with both repositories. But when using Eclipse, I always get the <code>Invalid remote: origin</code> error when trying to clone or pull from the repository with the secondary key:</p>
  
  <pre><code>Caused by: org.eclipse.jgit.errors.NoRemoteRepositoryException: git@bitbucket.org:myuser/myrepository.git: conq: repository access denied.
  </code></pre>
  
  <p>I added the secondary key at <code>Window &gt; Preferences &gt; Network Connections &gt; SSH2 &gt; Private keys</code>, and set the <code>GIT_SSH</code> environment variable to point to my <code>ssh</code> executable:</p>
  
  <pre><code>$echo $GIT_SSH
  /usr/bin/ssh
  </code></pre>
  
  <p>I've restarted Eclipse and even the OS several times, with no luck.</p>
  
  <p>Since I can use git from the command line without problems, I tend to believe there's something wrong with Eclipse.</p>
  
  <p>How to use multiple Git SSH keys on Eclipse? Or how to force Eclipse to use my secondary key on a single project?</p>