Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove cached credentials from Git?

I ran:

$ git config credential.helper store 

And then:

$ git push origin master 

After pushing, I entered my credentials and they were saved.
I read that they are stored in plaintext, and so now I want to remove my credentials from being saved and entered by default.

How can I do this?

like image 519
Max Li Avatar asked May 29 '17 16:05

Max Li


People also ask

How do I clear my git cache credentials?

To reset your cached credentials so that Git prompts you to enter your credentials, access the Credential Manager in the Windows Control Panel under User Accounts > Credential Manager. Look for the GitHub entry and delete it.

How do I clear my git-credentials on Mac?

On Mac, use the command git credential-osxkeychain erase . OR remove manually from keychain from Applications → Utilities → Keychain Access. Then remove the github.com keychain. Then use push; it will ask for the keychain access; then deny.

Where are my git-credentials stored?

The default path for the git credential store is $HOME/. git-credentials (or $XDG_CONFIG_HOME/git/credentials, if the previous location doesn't exist).


2 Answers

Run the following command in the terminal to remove your credentials stored in the cache

git config --global --unset credential.helper 
like image 54
Coder Avatar answered Sep 21 '22 13:09

Coder


Your credentials are stored in the file you (or the thing using git credential-store) specified when you (or it) ran the command, as described in the documentation. The default is $HOME/.git-credentials. You should be able to open this file in your editor and edit it, or simply remove it entirely.

Note that you may also want to change the credential helper so that these are not stored again. See the git credential-cache documentation as well, for instance.

like image 28
torek Avatar answered Sep 19 '22 13:09

torek