Warm tip: This article is reproduced from stackoverflow.com, please click
configuration credentials git

Unset/Forget/Repalce a user git Credential.Helper and remember new one

发布于 2020-05-03 20:54:34

I am only able to able to unset (temporarily) my credentials with following

git config credential.helper ""

This overrides the store option and every time i am asked for username password but it is not a solution because I want to store my new credentials but as soon as i apply

git config credential.helper store

It again stores the unwanted remembered user (Muha****) please see screenshots and I am stuck again to push to my repo, please help me to get rid of that remembered username

What config I have now is

enter image description here enter image description here enter image description here

I studied and followed almost everything relevant given in following answers

How do I update the password for Git?

How to change my Git username in terminal?

https://askubuntu.com/questions/206449/git-config-global-file-remove-settings

But never able to forget/replace completely my old user (Muha***)

Questioner
Sami
Viewed
56
bk2204 2020-02-17 03:58

The easiest way to delete credentials for Git is to run a command like the following, which tells whatever credential helper you're using that the password is invalid and it should delete it:

$ echo url=https://bk2204@github.com | git credential reject

Your URL must have the proper scheme, username, and host, but generally need not have the remainder of the URL (unless you've set credential.useHTTPpath) or the password. This should work anywhere the credential helper speaks the protocol correctly, although it is known that the Git Credential Manager for Windows is broken in this regard.

Once you delete the existing username and password, you'll be prompted again the next time and can enter a new username and password. Note that if you need to have two different usernames for the same domain, the easiest way to do that is to put the username in the remote URL, and the credential manager will automatically fill in the right password for the right user.