-
-
Save w0rd-driven/60779ad557d9fd86331734f01c0f69f0 to your computer and use it in GitHub Desktop.
| 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 |
Very useful.
regex:(?i)(barbz)==> # Matches "barbz" insensitively
Hi!
Do you know if there's anyway to use the BFG command to delete files but applying it only to an specific path in the repository?
Several files might match the regex expressions that I'm building but I would like to filter so that it only applies to the files I want.
Thanks!
I found these two flags @fcu423, maybe they can help:
--filter-content-including <glob> do file-content filtering on files that match the specified expression (eg '*.{txt,properties}') --filter-content-excluding <glob> don't do file-content filtering on files that match the specified expression (eg '*.{xml,pdf}')
For those who want to know which flavor of regex is accepted by regex, it's the one that's used with grep.
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!
@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
For developers working with Git history and sensitive data, this GitHub Gist provides a practical example of using BFG Repo-Cleaner to replace passwords and other unwanted content with literal strings or regular expressions. If you’re also exploring product-focused resources and want to view more about Kaboom products, including its cleaning solutions and collectible offerings, this site provides a useful starting point.
Thanks!