Search code examples
gitpowershellgit-bashbfg-repo-cleaner

How to fix "bfg: command not found" in git-bash


I am trying to use BFG Repo Cleaner to replace some text in one of my git repos.

I have downloaded and installed the jar file, but when I try to run the bfg command I get error "bfg: command not found".

When I run the bfg.jar file it seems to work fine, but if I try to use the command to run the bfg.jar file and the bfg command I am trying to execute, I get error "Unable to access jarfile bfg.jar".

I have copied the bfg.jar file location and name directly to avoid typos. I have tried in git-bash and in powershell and get the same error.

Here is the commands I have tried in both powershell and git-bash, as well as the responses I am getting:

$ java -jar /c/workspace/bfg-1.13.0.jar
bfg 1.13.0
Usage: bfg [options] [<repo>]

$  bfg --replace-text private.txt  repo-name.git
bash: bfg: command not found

$  bfg --rt --replace-text private.txt  repo-name.git
bash: bfg: command not found

$ java -jar /c/workspace/bfg-1.13.0.jar --replace-text private.txt  repo-name.git
Error: Unable to access jarfile bfg-1.13.0.jar

Can anyone see what I am doing wrong here? I wasn't able to find anything with this same issue so I know it's user error but I cannot find my issue.

Thanks for the help!


Solution

  • The answer was to run the commands from the location of the bfg.jar and enter the full path of the git mirror. Thank you brandon!