If you accidentally perform a commit with sensitive data, I found this recovery approach to be fairly straightforward.
- (Optional) If you want to keep the file but not the changes, save off the file that has the secret. The command below will completely remove the file.
- Install Python if not already installed
- From command line
pip install git-filter-repo
- Clone a fresh copy of the repository
- Run the command to remove the file