【问题标题】:Git: Delete a specific file using bfg (beg-repo-cleaner)Git:使用 bfg (beg-repo-cleaner) 删除特定文件
【发布时间】:2017-07-20 15:22:53
【问题描述】:

我正在尝试从 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

如何只删除这个特定文件?

【问题讨论】:

    标签: git bfg-repo-cleaner


    【解决方案1】:

    “警告:一旦您将提交推送到 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
    

    【讨论】:

    • 我按照 bfg 网站上的文档的建议做了一个 git 镜像。为此我需要做一个正常的克隆
    • 当我在 repo 上运行你的命令时,它会说:C:\path\to\some-repo\app is not a valid Git repository.
    • @YahyaUddin 你应该从 repo 的根目录运行命令。在您的示例中: C:\path\to\some-repo
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-17
    • 2016-10-09
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多