8

我试图从 Git 历史记录中永久删除一个文件,因为它包含敏感数据。

为此,我正在使用bfghttps ://rtyley.github.io/bfg-repo-cleaner/

该文件称为app/config.json.

但是config.json,我不想删除其他文件夹中调用的其他文件。

我尝试了以下方法:

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

但我收到错误消息:

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

如何仅删除此特定文件?

4

1 回答 1

3

“警告:一旦你将提交推送到 GitHub,你应该考虑它包含的任何数据都被泄露。如果你提交了密码,请更改它!如果你提交了一个密钥,则生成一个新的。” https://help.github.com/articles/removing-sensitive-data-from-a-repository/

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

你也可以试试:

bfg --replace-text config.json
于 2017-07-20T15:41:14.000 回答