mac 使用 brew安装包报错 fatal: not in a git directory,Error: Command failed with exit 128: git

在 mac 下使用 brew 安装包的时候,最后一行会报错:

fatal: not in a git directory

Error: Command failed with exit 128: git

导致包安装不成功,解决办法:

brew -v

 绿色框就是提示你需要做的,输入

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask

再次使用 brew install xxx 安装包,可以安装成功啦!

参考文章

posted @ 2023-06-27 12:13  蓓蕾心晴  阅读(213)  评论(0编辑  收藏  举报