title: Why is Git using a wrong account (with osxkeychain)?
body: <p>I have two github accounts, which I'll call ActOne and ActTwo, with emails which I'll call em@one.net and em@two.net. I need to switch off between the two accounts, but I can't get the second account to work.</p>
  
  <p>My current project uses the ActTwo account. When I say <code>git push</code>, I get this error message: </p>
  
  <pre><code>remote: Permission to ActTwo/Tools.git denied to ActOne.
  fatal: unable to access 'https://github.com/ActTwo/Tools.git/': The requested URL returned error: 403
  </code></pre>
  
  <p>I don't know why it's trying to use ActOne instead of ActTwo. My current project's .git/config file looks like this:</p>
  
  <pre><code>[core]
          repositoryformatversion = 0
          filemode = true
          bare = false
          logallrefupdates = true
          ignorecase = true
          precomposeunicode = true
  [remote "origin"]
          url = https://github.com/ActTwo/Tools.git
          fetch = +refs/heads/*:refs/remotes/origin/*
  [branch "master"]
          remote = origin
          merge = refs/heads/master
  [user]
          email = em@two.net
          name = ActTwo
  [credential]
          helper = osxkeychain
  </code></pre>
  
  <p>My ~/gitconfig file looks like this:</p>
  
  <pre><code>[color]
          ui = auto
  [filter "lfs"]
          smudge = git-lfs smudge %f
          required = true
          clean = git-lfs clean %f
  [credential]
          helper = osxkeychain
  </code></pre>
  
  <p>It used to have this, but I removed it in a vain attempt to fix the problem:</p>
  
  <pre><code>[user]
          email = em@one.net
          name = ActOne
  </code></pre>
  
  <hr>
  
  <p>Addendum:</p>
  
  <p>The problem seems to be because my credential helper (osxkeychain) has associated ActOne to the github URL. I added a second entry to Keychain Access for the other account, but it doesn't work. And the reason it doesn't work is that the "Access Control" tab doesn't have an entry for git-credential-osxkeychain. And I can't add one, because the actual application is inside my xCode application bundle, and there isn't any way that I can find in KeychainAccess to go inside an application bundle. Is this the right approach? Does anyone know how to do this?</p>