mac解决brew install报错“fatal: not in a git directory“

macbook上使用brew安装软件时,可能会遇到问题,报错如下:

复制代码
fatal: not in a git directory
Error: Command failed with exit 128: git

使用brew -v,仔细看,可以发现有两个fatal(致命错误)提示:

解决方案:

直接复制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 -v无报错

再次使用brew install安装软件,完美解决

相关推荐
nightunderblackcat1 小时前
新手向:Git下载全攻略
git
Dxy12393102161 小时前
python把文件从一个文件复制到另一个文件夹
开发语言·python
sonrisa_2 小时前
collections模块
python
折翼的恶魔2 小时前
数据分析:排序
python·数据分析·pandas
天雪浪子2 小时前
Python入门教程之赋值运算符
开发语言·python
他们都不看好你,偏偏你最不争气3 小时前
【iOS】AFNetworking
开发语言·macos·ios·objective-c
站大爷IP3 小时前
5个技巧写出专业Python代码:从新手到进阶的实用指南
python
hrrrrb3 小时前
【Python】字符串
java·前端·python
大翻哥哥3 小时前
Python 2025:低代码开发与自动化运维的新纪元
运维·python·低代码
Source.Liu4 小时前
【Pywinauto库】12.2 pywinauto.element_info 后端内部实施模块
windows·python·自动化