git filter repo - 未找到 Python - 但已安装

问题描述

所以我第一次尝试使用 git filter-repo。 我已经安装了 Python 3.9。 我尝试运行: git filter-repo --strip-blobs-bigger-than 100M

每次失败:

  • Git Bash:git: 'filter-repo' is not a git command.
  • Powershell:Python was not found;
  • CMD:Python was not found;

对我遗漏的东西有什么建议吗?

解决方法

仔细检查 newren/git-filter-repo/INSTALL 上的安装过程

您必须首先(在常规 CMD 中)确保 git-filter-repo 在您的 %PATH% 中。
例如,如果您通过 pip 安装它,它应该,因为 Python folder should be added to your PATH at Python3 installation

一旦 %PATH% 正确(并且您在其中看到 git-filter-repo),那么 git 将识别 filter-repo 命令。


As commented,现在有一个 git-filter-repo Homebrew formula,可在 Mac 上提供更简单的安装过程。