I\'m working with several repositories, but lately I was just working in our internal one and all was great.
Today I had to commit and push code into other one, but
Got same error when doing a 'git pull' and this is how I fixed it.
git config --system --unset credential.helper
git config --system --add credential.helper manager
git pull
For macOS users :
This error appears when you are using multiple Git accounts on the same machine.
Please follow below steps to remove the github.com credentials.
- Go to Finder
- Go to Applications
- Go to Utilities Folder
- Open Keychain Access
- Select the github.com and Right click on it
Delete "github.com"
Try again to Push or Pull to git and it will ask for the credentials. Enter valid credentials for repository account. Done
If this problem comes on a Windows machine, do the following.
The Git credential cache runs a daemon process which caches your credentials in memory and hands them out on demand. So killing your git-credential-cache--daemon process throws all these away and results in re-prompting you for your password if you continue to use this as the cache.helper option.
You could also disable use of the Git credential cache using git config --global --unset credential.helper
. Then reset this, and you would continue to have the cached credentials available for other repositories (if any). You may also need to do git config --system --unset credential.helper
if this has been set in the system configuration file (for example, Git for Windows 2).
On Windows you might be better off using the manager helper (git config --global credential.helper manager
). This stores your credentials in the Windows credential store which has a Control Panel interface where you can delete or edit your stored credentials. With this store, your details are secured by your Windows login and can persist over multiple sessions. The manager helper included in Git for Windows 2.x has replaced the earlier wincred helper that was added in Git for Windows 1.8.1.1. A similar helper called winstore is also available online and was used with GitExtensions as it offers a more GUI driven interface. The manager helper offers the same GUI interface as winstore.
Extract from the Windows 10 support page detailing the Windows credential manager:
To open Credential Manager, type "credential manager" in the search box on the taskbar and select Credential Manager Control panel.
And then select Windows Credentials to edit (=remove or modify) the stored git credentials for a given URL.
Retype:
$ git config credential.helper store
And then you will be prompted to enter your credentials again.
WARNING
Using this helper will store your passwords unencrypted on disk
Source: https://git-scm.com/docs/git-credential-store
You can remove the line credential.helper=!github --credentials
from the following file C:\Program Files\Git\mingw64\etc\gitconfig
in order to remove the credentials for git