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

相关推荐
爱上纯净的蓝天1 天前
Git 入门完全指南:从安装到第一次开源贡献
git·开源
曦月逸霜1 天前
啥是RAG 它能干什么?
人工智能·python·机器学习
小陈同学,,1 天前
如何切换git仓库
git
2301_769340671 天前
如何在 Vuetify 中可靠捕获 Chip 关闭事件(包括键盘触发).txt
jvm·数据库·python
南 阳1 天前
Python从入门到精通day66
开发语言·python
m0_596749091 天前
JavaScript中手动实现一个new操作符的底层逻辑
jvm·数据库·python
DTAS尺寸公差分析软件1 天前
DTAS3D v13.0 三维尺寸公差分析软件可申请试用
python·尺寸公差分析·三维公差分析·公差仿真软件·尺寸链计算
DTAS尺寸公差分析软件1 天前
DTAS 3D公差分析软件最新版本介绍
python·3d·尺寸公差分析·尺寸链计算·尺寸工程·尺寸链校核软件·公差仿真分析
PieroPc1 天前
CAMWATCH — 局域网摄像头监控系统 Fastapi + html
前端·python·html·fastapi·监控
feasibility.1 天前
反爬十层妖塔:现代爬虫攻防的立体战争
爬虫·python·科技·scrapy·rust·go·硬件