I have two GitHub accounts on the same Mac. And have credential-osxkeychain installed. It works fine with my first GitHub account. But, how can I add the second account into the keychain access? If it is not possible, how can I 'logout' my first account?

P.S. I can't use SSH key on my network.

P.S. I have already set git config user.name & git config user.email at the second repo. Error 403 show up when I git push. Github didn't ask me for the password of the second account. I think git is pushing the repo with the wrong account & password.

  • I know it's possible to configure a single repository with git config --local for a particular user. But there must be another way. – fabiopagoti Sep 7 '12 at 19:59
  • I have set the git config user.name & git config user.email for that repo. But I got error 403 when I push it. – user1597243 Sep 8 '12 at 10:28
  • 3
    user.name and user.email have nothing to do with authentication, these are just values which are recorded during commit. – knittl Sep 8 '12 at 12:23
  • then how to add another account to authentication? – user1597243 Sep 8 '12 at 18:34
  • Why do you even need two github accounts? FWIW authentication is done via the push url (which is normally starting with ssh://) – knittl Sep 8 '12 at 18:44

If you're trying to use SSH authentication, Github is probably seeing the first ssh key and associating it with the first account, then denying that account access to the second account's repos. I suggest switching one or both of the accounts to http based access.

For example, over SSH my repo URL would be: git@github.com:opie4624/repoA.git while the HTTP equivalent would be: https://github.com/opie4624/repoA.git.

When pushing or pulling with the HTTP url, git will prompt for the username and password allowing you to specify which of the two Github accounts to use. That also saves you from mucking about with ssh keys.

Hope this helps!

| improve this answer | |

Lastly, I go to Keychain Access and delete/modify the entry of github.com. Thus, I can login another account when pushing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.