Simon H
Simon H

Reputation: 21005

What are the parameters for using bfg

I am trying to clean something out of my git repo using bfg. The author's instructions suggest

java -jar bfg --replace-text passwords.txt  my-repo.git

I understood these to mean

java -jar bfg.jar --replace-text <some text?> <a directory?>

But all my efforts to provide a text and a directory get an error Error: Option --replace-text failed when given 'some-text'. some-text (No such file or directory). Has anyone worked out how use bfg?

My aim is to remove a short string from my history (probably only appearing in one file but I can't be sure of that)

Upvotes: 5

Views: 2242

Answers (1)

VonC
VonC

Reputation: 1324657

rtyley/bfg-repo-cleaner issue 154 provides the following example:

So you create a file called, e.g. replacements.txt, and put stuff like this in it - one line per password, credential, etc:

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

...then you run the BFG, specifying the file of replacements:

$ java -jar bfg.jar  --replace-text replacements.txt  my-repo.git

You should put your short string into a test file.

Upvotes: 3

Related Questions