I know that pushing a commit with an API key is something for which a developer should have his balls cut off, but…
…I’m wondering what I should do if, somehow, I accidentally commit an API key or other sensitive information, an environment variable to the repo.
Should I just revoke the access and leave it as is, or maybe locally remove this commit and force-push a new one without the key? How do you guys handle this situation in a professional environment?
Rotate the keys, the old one is on the Internet forever
This is the only answer. Git history is forever.
you can overwrite it
If you upload anything to the internet unencrypted, it’s always best to assume it’ll be publicly accessible forever.
Another user shared this link. https://trufflesecurity.com/blog/anyone-can-access-deleted-and-private-repo-data-github
s/git/github please