Someone commits a .env file, notices ten minutes later, deletes it in the next commit, and everyone relaxes. The file is gone from the working tree. It is not gone from the repository. Every clone still carries the commit that added it, and git log -p will print the key for anyone who asks.
A secret scanner will find that key. But a scanner hit is a lead, not a verdict. The questions that actually decide what you do next are: is this a real credential, does it still work, and where else does it live? This post walks through answering those on your own repository with two open-source tools, then fixing it in the right order.
Scope note before we start: only scan repositories you own or are authorized to assess. Verification (step 3) sends each candidate credential to its provider's API, which is exactly what you want for your own keys and exactly what you must not do with anyone else's.
Why "I deleted it" doesn't help
You can see the problem in under a minute.…