SSH IdentitiesOnly=yes forwarding all my keys
<p>I cannot for the life of me figure out why my SSH config is forwarding the wrong key. I have two keys, we'll call them <code>home_rsa</code> and <code>work_rsa</code>. I have done the following:</p>

<pre><code>eval `ssh-agent`
ssh-add -K ~/.ssh/home_rsa
ssh-add -K ~/.ssh/work_rsa
</code></pre>

<p>Here is my <code>~/.ssh/config</code> file:</p>

<pre><code>Host home
  ForwardAgent yes
  HostName home.com
  IdentityFile ~/.ssh/home_rsa
  IdentitiesOnly yes
  User home

Host work
  ForwardAgent yes
  HostName work.com
  IdentitiesOnly yes
  IdentityFile ~/.ssh/work_rsa
  User work

Host bitbucket
  IdentityFile ~/.ssh/home_rsa

Host bitbucket-work
  IdentityFile ~/.ssh/work_rsa

Host bitbucket*
  HostName bitbucket.com
  User git
</code></pre>

<p>When I run the following…</p>

<pre><code>ssh work
ssh git@bitbucket.org
</code></pre>

<p>…Bitbucket reports that I'm using my <code>home</code> user, though I'm clearly logged into my <code>work</code> server and should be forwarding my <code>work</code> key. If I add my SSH identities in the reverse order and run the same code above, Bitbucket reports I'm using my <code>work</code> user. Running <code>ssh-add -l</code> from my <code>work</code> server, I see that both SSH keys are being forwarded, but isn't that the job of <code>IdentitiesOnly yes</code>?</p>

<p>Really confused as to what's going on here.</p>