Skip to main content

Prerequisites

Before installing git-filter-repo, ensure you have:
  • Git >= 2.36.0
  • Python >= 3.6
You can verify your versions with:
git --version
python3 --version

Installation Methods

Advanced Installation (For Library Use)

If you want to use git-filter-repo as a Python library or use contrib scripts:
1

Create git_filter_repo.py

Create a symlink or copy of git-filter-repo named git_filter_repo.py:
ln -s git-filter-repo git_filter_repo.py
# or
cp git-filter-repo git_filter_repo.py
2

Place in Python path

Place git_filter_repo.py in your Python site-packages or anywhere in $PYTHONPATH:
SITE_PACKAGES=$(python3 -c "import site; print(site.getsitepackages()[-1])")
sudo cp git_filter_repo.py $SITE_PACKAGES/

Platform-Specific Notes

Windows can present some unique challenges:

Non-functional Python Stub

Windows sometimes ships with a non-functional Python stub that can cause the application to hang. Install Python from the Microsoft Store.

Python Executable Name

If your Python executable is named python instead of python3, you have two options:
  1. Edit the first line of git-filter-repo to use python instead of python3
  2. Use the full form in commands: python git-filter-repo instead of git filter-repo
If git_filter_repo.py appears as a regular file with just one line instead of a proper symlink, delete it and create a copy instead:
del git_filter_repo.py
copy git-filter-repo git_filter_repo.py

Verification

Verify your installation by running:
git filter-repo --version
Or display the help:
git filter-repo -h

What Gets Installed

A complete installation includes:

git-filter-repo

The main executable script. Required for all use cases.

git_filter_repo.py

Python library module. Optional, needed for using filter-repo as a library.

git-filter-repo.1

Man page. Optional, enables git filter-repo --help on Linux/Mac.

git-filter-repo.html

HTML documentation. Optional, enables git filter-repo --help on Windows.

Next Steps

Quickstart

Try your first repository filtering

Analyzing Repositories

Analyze your repo to decide what to filter

Build docs developers (and LLMs) love