I want to use git-filter-repo for my project to move multiple folders from one repository to a new repository. GIT documentation recommend to use git-filter-repo instead of git-filter-branch but I have never user Python before.

I installed the latest python (3.10.0) and GIT (2.33.1.windows.1).

I found the INSTALL.md instructions confusing so I've Googled and tried a few suggestions without much luck in getting this to work, but it seems something has happened and I'm not too sure how or what. I'm not sure what I should do next or if I'm using this correctly, I would appreciate some guidance.

I updated git-filter-repo first line to this #!/usr/bin/env python3

FYI: git --exec-path= C:/Program Files/Git/mingw64/libexec/git-core

I added the following to Path environment variable

  • C:\Users{username}\AppData\Local\Programs\Python\Python310
  • C:\Program Files\Git
  • C:\Program Files\Git\mingw64\libexec\git-core
  • C:\Users{username}\AppData\Roaming\Python\Python310\Scripts

I also moved git-filter-repo file into git's path location

I ran pip install (python/python3 didn't work but py did)

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

WARNING: The script git-filter-repo.exe is installed in 'C:\Users{username}\AppData\Roaming\Python\Python310\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Successfully installed git-filter-repo-2.33.0

So I added the following to Path environment variable

  • C:\Users{username}\AppData\Roaming\Python\Python310\Scripts

And ran py -m pip install --user git-filter-repo again

Requirement already satisfied: git-filter-repo in c:\users{username}\appdata\roaming\python\python310\site-packages (2.33.0)

I now get the following when I run git git-filter-repo in CMD

C:\Users{username}\bin>git git-filter-repo

git: 'git-filter-repo' is not a git command. See 'git --help'.

And in Gitbash I get this;

$ git-filter-repo

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

If I updated git-filter-repo first line to this #!/usr/bin/env py

And in gitBash when I run git filter-pro it spawns 100's of python.exe and kills the machine.

enter image description here

I've followed these posts


How do you install git-filter-repo?

How do you install git-filter-repo?

2 Answers 2


I would appreciate some guidance.

Short answer, try git filter-repo (note the space) from cmd. For using git-filter-repo directly (again, from cmd, not Git Bash), try git-filter-repo.

Long Answer

The steps below worked for me on Windows (at least to get git-filter-repo installed) since the PyPI page for git-filter-repo lists the module as OS independent:

  1. Get e.g. Python 3.8.8 from https://www.python.org. Skip the Microsoft Store version of Python. Currently, git-filter-repo may work with Python 3.10, but it is possible it may also introduce issues when using the script.

  2. Have Git for Windows installed and available via cmd as git.

  3. Install Python 3.8.8 in a non-system folder without spaces (i.e. NOT in Program Files, Program Files (x86) or AppData). Something like e.g. C:\Programs is acceptable.

  4. Add your Python installation folder (e.g. C:\Programs\Python38-32) to your System Path variables (not your User PATH variables).

  5. Reboot.

  6. Open a cmd window and type python -V, then where python. You should get back e.g. Python 3.8.8 for the first command and the full path to your e.g. Python 3.8.8 installation for the second command. If you have another entry for Python before the path to Python 3.8.8, you may need to take additional steps.

  7. Assuming Step 6 meets the requirements outlined, use python -m pip (rather than just pip or py -m pip) to install the latest version of git-filter-repo with:

    python -m pip install git-filter-repo
  8. git filter-repo (note the space) should now be available via cmd. If you want to use the git-filter-repo command directly (i.e. in cmd, but without involving git), ensure that the correct Python Scripts directory (e.g. C:\Programs\Python38-32\Scripts) is listed in your System Path variables (Step 4) before any other Python Scripts directory (if they exist).


  • Python 3.8.8 was the last binary release of the Python 3.8.x line, which (at the time of writing) is the last major version of Python PyPI lists as (officially) supported by git-filter-repo.

  • I believe my current copy of Git for Windows was installed with the "Minimal Tools" option for cmd. In any case, I didn't try making this work with Git Bash.

  • My copy of Git for Windows was installed in a folder without spaces. Folders with spaces can sometimes be an issue for cross-platform script (e.g. ones that are supported under both Linux and Windows).


These suggestions are for following the Long Answer outlined above:

  • Remove the git-filter-repo file you placed into git's path location.

  • If you only have Python 3.10 installed and only for git-filter-repo, you may want to uninstall it and py (the Python Launcher) before doing the Long Answer (above). This isn't technically required, but could save future headaches.

  • The same goes for removing Path environment variables for:

    • C:\Users{username}\AppData\Local\Programs\Python\Python310

    • C:\Users{username}\AppData\Roaming\Python\Python310\Scripts

  • Thank you got your detailed suggestion, fortunately before going ahead with uninstalling and reinstalling I managed to find a way to make thing work.
    – david-l
    Commented Oct 26, 2021 at 15:08
  • Glad to hear you got it working. =) Commented Oct 26, 2021 at 19:51
  • This is the only set of instructions I've found that actually work to install git-filter-repo on Windows. You've saved me a lot of pain, my friend. Commented Sep 2, 2022 at 11:04

After 24 gruelling hours attempting to get this to work I've finally solved my issue.

I mentioned in the main post I was getting issue with 100's of python.exe spawning, it seems I'm not the only one.


Having read the above I thought I'd try one last thing, the above post mentioned this worked with Anaconda PowerShell Prompt in Administrator mode, and I wondered if that Powershell version "understood" what the shebang to #!/usr/bin/env python meant.

So I created another environment "PYTHON" variable under "User variables for admin" (see image below) reverted my changed that I made to git-filter-repo #!/usr/bin/env python and everything started to work.

I hope this helps someone in the future.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .