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
If you want git to forget old saved credentials and re-enter username and password, you can do that using below command:
git credential-cache exit
After running above command, if you try to push anything it will provide option to enter username and password.
Need to login with respective github username
and password
To Clear the username and password in windows
Control Panel\User Accounts\Credential Manager
Edit the windows Credential
Remove the existing user and now go to command prompt write the push command it shows a github pop-up to enter the username
/email
and password
.
Now we able to push the code after switching the user.
On Windows, at least, git remote show [remote-name] will work, e.g.
git remote show origin
You have to update it in your Credential Manager.
Go to Control Panel > User Accounts > Credential Manager > Windows Credentials. You will see Git credentials in the list (e.g. git:https://). Click on it, update the password, and execute git pull/push command from your Git bash and it won't throw any more error messages.
In case Git Credential Manager for Windows is used (which current versions usually do):
git credential-manager clear
This was added mid-2016. To check if credential manager is used:
git config --global credential.helper
→ manager
This error appears when you are using multiple Git accounts on the same machine.
If you are using macOS then you can remove the saved credentials of github.com.
Please follow below steps to remove the github.com credentials.
Done