Skip to content

Instantly share code, notes, and snippets.

@w0rd-driven
Created November 18, 2016 20:19
Show Gist options
  • Save w0rd-driven/60779ad557d9fd86331734f01c0f69f0 to your computer and use it in GitHub Desktop.
Save w0rd-driven/60779ad557d9fd86331734f01c0f69f0 to your computer and use it in GitHub Desktop.
BFG Repo-Cleaner --replace-text example
PASSWORD1 # Replace literal string 'PASSWORD1' with '***REMOVED***' (default)
PASSWORD2==>examplePass # replace with 'examplePass' instead
PASSWORD3==> # replace with the empty string
regex:password=\w+==>password= # Replace, using a regex
regex:\r(\n)==>$1 # Replace Windows newlines with Unix newlines
@yamunaarumugam
Copy link

Hi, is there a way to search like "PASSWORD1".

Consider commit history with the following line:
password: "PASSWORD1"

When I replace the commit history, the above line becomes,
password: "REMOVED"

Again I'm getting secrets detected in repository.

Please provide your suggestions.
Thanks in advance!

@moritztim
Copy link

@yamunaarumugam If you have this exact situation (Password: "something") and you want it to be removed, the following regular expression should work. But use an online regex tester to check if it works first

regex:(?<=Password: ")[^"]*==>REMOVED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment