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

相关推荐
overmind7 小时前
oeasy Python 114 在列表指定位置插入insert
开发语言·python
dingdingfish7 小时前
Bash学习 - 第6章:Bash Features,第10节:The Restricted Shell
bash·shell·rbash·restrict
喵手7 小时前
Python爬虫实战:监控型爬虫实战 - 从结构检测到智能告警的完整方案(附CSV导出 + SQLite持久化存储)!
爬虫·python·爬虫实战·零基础python爬虫教学·csv导出·监控型爬虫实战·从结构哦检测到智能告警
深蓝电商API7 小时前
爬虫中 Cookie 池维护与自动刷新
爬虫·python
蜡笔羊驼7 小时前
LALIC环境安装过程
开发语言·python·深度学习
Starry_hello world7 小时前
Python(1)
python
codeJinger7 小时前
【Python】基础知识
开发语言·python
一切顺势而行8 小时前
python 文件目录操作
java·前端·python
woshikejiaih8 小时前
2026年阅读软件Top5避坑攻略:告别卡顿闪退提升沉浸感
人工智能·python
007张三丰9 小时前
2026马年开年寄语
python·ai工具·祝福·新技术·新年·马年