Remove Stored Git Credentials Mac [Solved]

Method Action Best For
Keychain Access Manual deletion via GUI Visual learners / UI users
Terminal git credential-osxkeychain erase Advanced users / Developers

macOS Keychain Access interface showing Git credentials for deletion.

What is Remove Stored Git Credentials Mac?

Removing stored Git credentials on a Mac refers to clearing saved usernames and passwords (or Personal Access Tokens) from the macOS Keychain Access utility. macOS uses a “credential helper” to securely store these details so you do not have to type them every time you push or pull code.

When you encounter a “Git Login Failed” error, it is usually because your remote provider (like GitHub or GitLab) has invalidated your old password or token. By removing the stored entry, you force Git to prompt you for new, updated credentials on your next action.

Step-by-Step Solutions

Method 1: Using Keychain Access (Recommended)

This is the most reliable way to ensure the old credentials are completely gone from the system UI.

  1. Press Cmd + Space and type “Keychain Access,” then hit Enter.
  2. In the search bar at the top right, type github.com (or your specific provider).
  3. Look for an entry of kind “Internet password.”
  4. Right-click the entry and select Delete “github.com”.
  5. Confirm the deletion.

Method 2: Using the Terminal

If you prefer the command line, you can use the Git credential helper directly to erase the stored data. Run the following command:

echo "url=https://github.com" | git credential-osxkeychain erase

Note: Replace “github.com” with your specific Git host if you are using Bitbucket or a self-hosted GitLab instance.

Method 3: Global Credential Reset

If you want to ensure Git isn’t using a different helper, you can check your global configuration. This ensures that the osxkeychain is indeed the manager being used.

git config --global credential.helper osxkeychain

Once you have removed the credentials using any of the steps above, run a command like git pull. Git will immediately prompt you for your username and password (or token), allowing you to save the new, correct information.