Linux - How to Remove Git Credentials

2019-03-11 07:08发布

I ran

git config credential.helper store

and ran

git push origin master

where I entered my credentials and they were saved.

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

How can I do this?

5条回答
我欲成王,谁敢阻挡
2楼-- · 2019-03-11 07:38

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

git config --global --unset credential.helper
查看更多
迷人小祖宗
3楼-- · 2019-03-11 07:42

If you would like the daemon to exit early, forgetting all cached credentials before their timeout, you can issue an exit action, run the following command.

git credential-cache exit

查看更多
劳资没心,怎么记你
4楼-- · 2019-03-11 07:51

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.

查看更多
The star\"
5楼-- · 2019-03-11 07:53

None of the above solutions worked for me. I revoked the access by deletion of the token I had generated the machine.

I logged into GitHub webpage went to: click picture > settings > Developer settings > Personal access tokens > delete the token for that particular machine

查看更多
狗以群分
6楼-- · 2019-03-11 08:00

As he did not give any flag as global or local or system, it would take local by default, so the correct way is to move to the respective folder(repository) and type this command

git config --local --unset credential.helper

or

git config --unset credential.helper

Reference: https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-config

查看更多
登录 后发表回答