I have a file in path/to/file.security.
I run
bfg --delete-files path/to/file.security my-repo.git
It show me error:
Error: *** Can only match on filename, NOT path *** - remove '/' path segments
I'm having this same issue, how did you solve it?
Actually, I ended up solving it by going to the directory that had the file I cared about and then running it as such java -jar /usr/local/bin/bfg.jar --delete-files private.key ../../
I think the commenter above sought to get around the path requirement by cd'ing into the directory, however, it would have been equivalent to simply do java -jar /usr/local/bin/bfg.jar --delete-files SOMEFILE.FOO without cd'ing. The command will destroy any SOMEFILE.FOO in the entire repo....so its actually a potentially catastrophic advice to follow.
@codeHatcher I am facing the same question, are you only trying to delete the SPECIFIC private.key file INSTEAD OF ALL instances of private.key ? Does that work?
The only way to delete a file qualified by a path using current BFG is to lookup its object id and address/delete it that way.
Why is this closed? This is a pretty major deficiency. What do I do if I have more than one directory named results and I only want to delete one of them? Scrubbing anything in your repo based on a blob match on the filename alone is potentially disastrous.
I would say, the solution is:
https://github.com/newren/git-filter-repo
Most helpful comment
I think the commenter above sought to get around the path requirement by cd'ing into the directory, however, it would have been equivalent to simply do
java -jar /usr/local/bin/bfg.jar --delete-files SOMEFILE.FOOwithout cd'ing. The command will destroy any SOMEFILE.FOO in the entire repo....so its actually a potentially catastrophic advice to follow.