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

tv6aics1  于 12个月前  发布在  Git
关注(0)|答案(2)|浏览(194)

所以我第一次尝试使用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;

有什么建议我错过了吗?

8qgya5xd

8qgya5xd1#

仔细检查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命令。
正如评论的那样,现在有一个git-filter-repo Homebrew formula,它在Mac上提供了一个更容易的安装过程。

nzk0hqpo

nzk0hqpo2#

我遇到了同样的问题:我把git-filter-repo放在PATH下,但我得到了同样的“Python not found”错误,即使Python已经安装在PATH下。
最后,我通过修改下载的git-fitler-repo文件的she-bang(顶部的第一个注解行)解决了这个问题。我把它从

#!/usr/bin/env python3

#!C:\Program Files\Python310\python.exe

(the我的系统上的真实的Python路径),现在它工作了。这是令人惊讶的,因为据我所知,Windows不尊重那些她-邦线荣誉。

相关问题