Mac brew -v 报错 fatal: detected dubious ownership in repository

Mac 电脑查询 brew版本时报错,如下错误:

Mac brew -v 报错 fatal: detected dubious ownership in repository_第1张图片

Last login: Fri Sep  8 14:56:21 on ttys021
sunshiyu@sunshiyudeMacBook-Pro-2 ~ %  brew -v
Homebrew 4.0.3-30-g7ac31f7
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)
Homebrew/homebrew-cask (git revision 7ac31f7d6; last commit 2023-02-21)
sunshiyu@sunshiyudeMacBook-Pro-2 ~ % 

解决办法:

根据上面的错误提示,注意:每个人的路径可能不同,不要直接拷贝我下面的路径,用自己的路径

执行这两个命令:

sunshiyu@sunshiyudeMacBook-Pro-2 ~ % git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
sunshiyu@sunshiyudeMacBook-Pro-2 ~ % git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

然后再查询brew版本

sunshiyu@sunshiyudeMacBook-Pro-2 ~ % brew -v
Homebrew 4.0.3-30-g7ac31f7
Homebrew/homebrew-core (git revision a0c6d795116; last commit 2023-02-22)
Homebrew/homebrew-cask (git revision 7ac31f7d6; last commit 2023-02-21)
sunshiyu@sunshiyudeMacBook-Pro-2 ~ % 

Mac brew -v 报错 fatal: detected dubious ownership in repository_第2张图片

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