当前位置:   article > 正文

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

mac brew detected dubious ownership in repository

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

在这里插入图片描述

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 ~ % 

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

解决办法:

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

执行这两个命令:

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
  • 1
  • 2

然后再查询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 ~ % 
  • 1
  • 2
  • 3
  • 4
  • 5

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/744070
推荐阅读
相关标签
  

闽ICP备14008679号