How do you install git-filter-repo?

This is how I got it to work.

  1. Python should be installed and added to the system's path.
  2. Git should be installed and git also added to the system's path.
  3. Download git-filter-repo
  4. Replace 'python3' on first line of file called git-filter-repo with 'python'. Depending on your python installation, you may skip this step.
  5. Call git --exec-path
  6. Move the git-filter-repo file into that location shown. (git's path).
  7. To use, type git filter-repo. The help option will not work, but they have documentation online.

pip install

They now have a python package that just works:

python3 -m pip install --user git-filter-repo

That method installs both the command line executable, and the Python library which you can use as shown here.

Alternatively, if for some reason you don't want to use pip, you can also:

# Add to bashrc.
export PATH="${HOME}/bin:${PATH}"

mkdir -p ~/bin
wget -O ~/bin/git-filter-repo https://raw.githubusercontent.com/newren/git-filter-repo/7b3e714b94a6e5b9f478cb981c7f560ef3f36506/git-filter-repo
chmod +x ~/bin/git-filter-repo

Tested on Ubuntu 20.04, git-filter-repo ac039ecc095d.