Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Sep 8 '12 at 16:35

This question came from our site for professional and enthusiast programmers.

    
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

2 Answers 2

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!

share|improve this answer
up vote 0 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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