安装完成homebrew后,运行brew -v
提示
Homebrew 4.0.6-186-g98a2923
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)
实际就是homebrew的根目录没有信任Homebrew/homebrew-core (no Git repository)和Homebrew/homebrew-cask (no Git repository),怎么解决以上的问题。
直接按照提示的运行这两个命令行即可
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 -v,即可看到这两个版本提示
brew -v
Homebrew 4.0.6-186-g98a2923
Homebrew/homebrew-core (git revision 5eaa252887b; last commit 2023-03-20)
Homebrew/homebrew-cask (git revision 51351c7c47; last commit 2023-03-20)
版权归原作者 Little_叉 所有, 如有侵权,请联系我们删除。