在Mac OS 通过 brew 安装wget工具时, 报如下错误

Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git_待解决

解决方法

1.先执行诊断,查看问题所在
brew doctor

会有如下警告提示

Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git_解决方法_02

2.根据警告, 执行提示的命令一一解决

如果不确定是否解决了部分问题,可以再次执行诊断查看

可以看到待解决的问题变少了

Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git_github_03

番外

当我在执行命令brew tap homebrew/core时,又出现了问题,但好在问题后面有解决方法:

Mac使用brew install 安装wget工具报错 fatal: not in a git directory Error: Command failed with exit 128: git_macos_04