Saturday, February 11, 2023

Clear Git Bash History | HowTo: Clear BASH History | How to clear bash shell history command

Sometimes you don’t want to leave Bash history, because it may contain some sensitive data (e.g. passwords, tokens, etc.).
To completely erase the Git Bash history you need to locate and delete the .bash_history file and then run the history -c command.
Run these commands in the Git Bash to locate and delete the .bash_history file:
User@Computer MINGW64 ~
$ echo $HISTFILE
- sample output -
/c/Users/<username>/.bash_history

User@Computer MINGW64 ~
$ rm /c/Users/<username>/.bash_history

User@Computer MINGW64 ~
$ history -c

No comments:

Post a Comment