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

相关推荐
happylifetree12 小时前
Python014-第二章13.数据容器-tuple案例
python
茉莉玫瑰花茶12 小时前
LangGraph 其他核心能力 [ 3 ]
python·ai
AI玫瑰助手12 小时前
Python函数:递归函数的定义与阶乘案例实现
开发语言·python·信息可视化
武子康12 小时前
调查研究-155 Open-LLM-VTuber 本地部署与互动实战指南
人工智能·python·深度学习·ai·数字人
北漂人Java13 小时前
Pycharm配置Miniconda教程
python·pycharm
CTA量化套保13 小时前
量化程序 while True 一直跑 CPU 很高:天勤降频与字段过滤
python·区块链
copyer_xyf13 小时前
Python 内存分析:从栈和堆理解对象引用
前端·后端·python
大蚂蚁2号13 小时前
深度剖析Python全局解释器锁(GIL):原理、瓶颈与终极破局方案
python
独挽离人13 小时前
git标准推送流程
git
高洁0113 小时前
打造行业知识图谱三步走
python·深度学习·数据挖掘·知识图谱