安装完成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)文章来源:https://www.toymoban.com/news/detail-440858.html
Homebrew/homebrew-cask (git revision 51351c7c47; last commit 2023-03-20)文章来源地址https://www.toymoban.com/news/detail-440858.html
到了这里,关于Mac本安装homebrew后git报错解决1的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!