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?
Simply view any file in your repository, click the trash can icon at the top, and commit the removal just like any other web-based edit. Then " git pull " on your local repo, and that will delete the file locally too.
Removes large or troublesome blobs like git-filter-branch does, but faster - and written in Scala - Fund the BFG. $ bfg --strip-blobs-bigger-than 1M --replace-text banned.txt repo.git.
"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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With