Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 835 Bytes

secrets_cleanup.md

File metadata and controls

18 lines (14 loc) · 835 Bytes

Procedure for removing secrets from the commit history

If there are secrets or sensitive data inadvertently committed to the git history, it can be removed with the procedure described below. Note: this procedure does not modify the HEAD commit, so make sure that there are no longer any secrets in the HEAD of the repository.

Procedure

  1. Download BFG from https://rtyley.github.io/bfg-repo-cleaner/
  2. Create a secrets.txt file with all strings (and patterns) which should be removed
  3. Run the following commands:
cd /tmp
git clone --mirror [email protected]:heckler/your-target-repository.git
java -jar /d/Users/heckler/Dropbox/Util/bfg.jar --replace-text secrets.txt your-target-repository.git
cd your-target-repository.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push