9

I am trying to delete a file permanently from the Git history, because it contains sensitive data.

To do this, I am using bfg: https://rtyley.github.io/bfg-repo-cleaner/

The file is called app/config.json.

However there are other files called config.json in other folders that I don't want deleted.

I tried the following:

git clone --mirror git://example.com/some-repo.git
bfg --delete-files app/config.json my-repo.git

but I get the error message:

Error: *** Can only match on filename, NOT path *** - remove '/' path segments

How do I delete just this specific file?

Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231

1 Answers1

3

"Warning: Once you have pushed a commit to GitHub, you should consider any data it contains to be compromised. If you committed a password, change it! If you committed a key, generate a new one." https://help.github.com/articles/removing-sensitive-data-from-a-repository/

cd my-repo/app
bfg --delete-files config.json

You could also try:

bfg --replace-text config.json
madnight
  • 420
  • 3
  • 10