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安装软件,完美解决

相关推荐
shykevin1 小时前
python开发Streamable HTTP MCP应用
开发语言·网络·python·网络协议·http
大大小小聪明1 小时前
Git合并多个提交方法详解
git·github
humiaor1 小时前
Xcode报错:“Set `maskView` to `nil` before adding it as a subview of ZFMaskView
ide·macos·xcode·ios18报错
漫路在线1 小时前
JS逆向-某易云音乐下载器
开发语言·javascript·爬虫·python
成功人chen某4 小时前
配置VScodePython环境Python was not found;
开发语言·python
2301_786964364 小时前
EXCEL Python 实现绘制柱状线型组合图和树状图(包含数据透视表)
python·microsoft·excel
skd89995 小时前
小蜗牛拨号助手用户使用手册
python
「QT(C++)开发工程师」5 小时前
STM32 | FreeRTOS 递归信号量
python·stm32·嵌入式硬件
史迪仔01125 小时前
[python] Python单例模式:__new__与线程安全解析
开发语言·python·单例模式
胡耀超5 小时前
18.自动化生成知识图谱的多维度质量评估方法论
人工智能·python·自动化·知识图谱·数据科学·逻辑学·质量评估