# Using BFG (simplest) bfg --delete-files password.txt my-repo.git git push --force Stop using password.txt . Use environment variables ( .env ) and ensure the .env file is listed in your .gitignore file.
Git stores history . If you commit a password on Monday and delete it on Tuesday, that password is still accessible via the Git commit log ( git log -p ). Anyone who clones the repo before you scrub the history can access it.
In the world of cybersecurity, some mistakes are so common they become memes. Near the top of that list is the dreaded password.txt file. When you combine that file with the world’s largest platform for open-source code—GitHub—you create a perfect storm of accidental data leaks.
But in the age of automated credential scraping, convenience is a liability. Before you commit that next password.txt , remember: a bot is already waiting.
Search your own GitHub for password.txt . You might be surprised at what you find.