home brew Error: Command failed with exit 128: git

问题描述:使用brew install php安装php,命令提示:Error: Command failed with exit 128: git。

排查原因:使用命令 brew -v 提示如下:

Homebrew 3.6.11
fatal: detected dubious ownership in repository at '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: detected dubious ownership in repository at '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)

根据提示,设置 brew 目录即可:

执行命令:
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

根据brew实际安装目录,每个人需要设置的路径不同,可以通过 brew -v 来查看。

你可能感兴趣的:(brew,git,git)