Coder Perfect

How can I get rid of Git’s cached credentials?


I ran:

$ git config credential.helper store

And then:

$ git push origin master

I inputted my credentials after pressing the button, and they were stored. I read that they are stored in unencrypted, thus I’d like to disable the automatic saving and entry of my credentials.

I’m not sure how I’m going to accomplish it.

Asked by Max Li

Solution #1

To clear your credentials from the cache, type the following command in the terminal.

git config --global --unset credential.helper

Answered by Coder

Solution #2

As mentioned in the documentation, your credentials are stored in the file you (or the thing utilizing git credential-store) provided when you (or it) issued the command. $HOME/.git-credentials is the default location. You should be able to open and edit this file in your editor, or simply delete it.

It’s also worth noting that you might want to alter the credential helper to prevent these from being stored again. See, for example, the git credential-cache docs.

Answered by torek

Solution #3

Because he did not specify whether the flag should be global, local, or system, it will default to local, therefore the right method is to navigate to the appropriate folder (repository) and type this c.

git config --local --unset credential.helper


git config --unset credential.helper


Answered by Karthik Kannan

Solution #4

You can issue an exit action to have the daemon exit early, forgetting all cached credentials before their timeout, by running the following command.

Answered by Atchyut Nagabhairava

Solution #5

The unset command did not work for me, so I removed the file instead:

rm ~/.git-credentials

Answered by juan Isaza

Post is based on