How do I sign out in the Git Bash console in Windows?

For Windows 10, if your PC has a different login (a MSFT account) and GitHub is on another login, if you go to control panel → user accounts and search for credential manager, you will see "Web Credentials" and "Windows credentials".

GitHub seems to be taking the default ID that is registered in the PC (Microsoft account). Under Windows Credentials, remove the GitHub login details and try Push again. You will be prompted for a GitHub ID and password explicitly. Once we login that gets stored as a personal access token for Git push.

GitHub credentials


First, user authentication has nothing to do with user.name and user.email git config.

And second, compared to the old answer "remove credentials from git", the latest Git for Windows uses Git Credential Manager (Git 2.9.2 => GCM 1.5.0).

Check your config (git config -l) and see if "manager" (or, more recently, 2020+: "manager-core") is registered there.
If not, set it up with:

 git config --global credential.helper manager-core

Since its v1.3.0 (April 2016), it had a delete command to purge credentials.

git credential-manager delete <url>

Update 2018: "delete" is now deprecated, use reject:
Update 2020: "reject" is now deprecated, use erase:

git credential-manager erase <url>

Actually, whatever 'xxx' credential manager you are using ('xxx' being the result of git config credential.helper), you can do:

printf "protocol=https\nhost=github.com" | git-credential-xxx erase

# Windows (2020-2021)
printf "protocol=https\nhost=github.com" | git-credential-manager-core erase

# Linux
printf "protocol=https\nhost=github.com" | git-credential-libsecret erase

# MacOs
printf "protocol=https\nhost=github.com" | git-credential-osxkeychain erase

This is better than fiddling with the Credential Manager of your OS.

That git-credential-xxx executable is in usr/libexec/git-core or (for Windows) mingw64/libexec/git-core of your Git installation.
As mentioned here, on MacOS, it should already be in /usr/local/git/bin/.


If git config credential-manager returns store, then Git uses the "store" mode, which saves the credentials to a plain-text file on disk, and they never expire.

type %USERPROFILE%\.git-credentials

I would remove that particular credential helper from the config, as it stores credentials in plain text.


The OP Lord Rixuel actually confirms in the comments it is a native Windows Credential Manager function which provides automatically (Git or not) the credentials:

I see the "Manage your credentials" option, I click on it out of curiosity, then I click on "Windows Credentials", under "Generic Credentials", there is "git:github.com";, I click on it and there is the "Remove" option. I clicked Remove.

When I do a git push, it asks again for my user and my password. Exactly what I want when I want to sign out.


Reason for this Issue :

1.Previously logged in account credentials are saved in Windows Credentials.

2.Due to this, Gitbash gives error and doesn't allow us to login for new credentials

For SOLUTION Follow the steps:

Control Panel -> User Accounts -> Manage your credentials -> Windows Credentials -> under Generic Credentials there are some credentials related to Github, click on them and click "Remove".

This removes any prior logins without any issues. A fresh new login check is provided in Gitbash console which asks for your login credentials in order to save them.