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

相关推荐
忘忧记12 小时前
python QT sqlsite版本 图书管理系统
开发语言·python·qt
长安牧笛12 小时前
车载模型白天晚上自动切换,自动切昼夜模型,颠覆统一模型,输出稳定识别。
python·编程语言
Katecat9966312 小时前
【项目实践】基于YOLO11的币面缺陷检测与类型识别_FeaturePyramidSharedConv
python
ljxp123456812 小时前
二叉树最大深度算法解析
python
dingdingfish12 小时前
Bash学习 - 第8章:Command Line Editing,第6-8节:Programmable Completion
bash·shell·completion·complete·compgen·compopt
nix.gnehc12 小时前
在K8s集群中部署Traefik并验证Python HTTP服务
python·http·kubernetes
laplace012312 小时前
第二章 字符串和文本 下
服务器·数据库·python·mysql·agent
得一录12 小时前
VS Code创建虚拟环境指南
python
List<String> error_P12 小时前
蓝桥杯高频考点练习:模拟问题“球队比分类”
数据结构·python·算法·模拟·球队比分
啊阿狸不会拉杆12 小时前
《计算机视觉:模型、学习和推理》第 4 章-拟合概率模型
人工智能·python·学习·算法·机器学习·计算机视觉·拟合概率模型