Skip to content

Reset GitHub Credentials

Published: at 11:00 PM

This particular pop-up asking which credentials should git use has recently started popping up a lot.

gcm select account pop up

Git Credential Helpers

Git employs an abstraction for storing your credentials using the Git Credential Manager (GCM). The GCM then employs ‘helpers’ to store your credentials.

You can find more about it here: https://git-scm.com/doc/credential-helpers.

Git Credential Manager, Keychain Access, Git OAuth

All credentials stored in windows are typically found in the windows credential manager. Some apps you use might prefer to use registry or environment variables. With respect to git, we have the Git Credential Manager (for windows) which is included with Git for Windows and uses the windows credential manager to store under the hood. Similarly, on Mac, it uses the Keychain Access tool. On Linux distros, well, Git Credential OAuth, is popular. (It’s cross platform too!)

Retrieve Credentials

Before we go ahead and remove and reset our credentials, we might want to see what we have. Perhaps, to backup. Use the below command.

> git credential-manager get
protocol=https
host=github.com

Note: you might intend to use a different host.

If you have several credentials under that host, it’ll ask you for which credentials you want to use, and then it’ll show you the stored credentials.

Removing Stored Credentials

Similar to the above command, you can remove stored credentials with the below command.

> git credential-manager erase
protocol=https
host=github.com
username=<username>

Note: If you don’t pass the username, it will erase all credentials under that host. It’s supposed to work that way, but when I tried it, it just removed the last added credential.

Let’s cover a few more ways…

Using Windows Credential Manager

  1. Search for Credential Manager.
  2. Click on Windows Credentials.
  3. Find any entries related to GitHub (e.g., git:https://github.com).
  4. Click Remove to delete the stored credentials.
  5. The next time you use Git, it will prompt you to enter new credentials.

Using Keychain Access

  1. Open Keychain Access
  2. Find github
  3. Select the github.com and Right click on it
  4. Delete “github.com”

Well, that’s all for now. If you’re interested in more, you can check out the Git Credential Manager repo on GitHub.


Previous Post
GitHub Configurations
Next Post
Setup a TypeScript Development Environment in a Container