This page looks best with JavaScript enabled

Easily Change GitHub User in OS X

   · β˜• 2 min read

Check Your Git Configuration

The first step is to run git config -l to see what the current configuration is. If the and/or properties are incorrect, change them using something like this:

git config --global "Mark McFate"
git config --global ""

That’s only half the battle. I love OS X and the Keychain Access app is wonderful, except when I’m working with git and GitHub in a terminal, which I do quite often. The real problem is that I have 4 different identities in GitHub… crazy, I know.

Altering Keychain Access from the Command Line

Changing from one identity to another has been a real pain-in-the-a$$, up until I found this gem of a post.

Basically, what it tells me to do from the command line is this:

Through the command line, you can use the credential helper directly to erase the keychain entry.

To do this, type the following command:

git credential-osxkeychain erase

…Press return twice if necessary.

If it’s successful, nothing will print out. To test that all of this works, try and clone a repository from GitHub. If you are prompted for a password, the keychain entry was deleted.

Works like a charm! But, if it doesn’t, and that has been my experience at times, I’ve opened the Keychain Access app and executed the steps documented in the next section. The next git... command I specify, if necessary, will prompt me for my GitHub username and password, and those are automatically saved until I repeat the git credential-osxkeychain erase command. Woot!

Changing Keychain Access in the GUI

If all else fails, I sometimes find it necessary to open my Mac’s Keychain Access app, search for all instances of, and delete the entry that generally has these properties:

  • Name: @
  • Kind: Internet password
  • Keychain: login

Once that has been removed, and the removal is saved, my git commands once again will prompt me for a valid username and password.

And that’s a wrap. Until next time…

Share on

Mark A. McFate
Mark A. McFate
Digital Library Applications Developer