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

相关推荐
大貔貅喝啤酒7 小时前
Python Requests库教程
自动化测试·python·requests库
copyer_xyf7 小时前
LangChain 调用 LLM
后端·python·agent
copyer_xyf7 小时前
Prompt 组织管理
后端·python·agent
shimly1234568 小时前
python3 uvicorn 是啥?
python
CTA量化套保9 小时前
期货量化程序 time.sleep 卡死:天勤单线程与 deadline 替代
python·区块链
allway29 小时前
How to Echo Multiline to a File in Bash [3 Methods]
开发语言·chrome·bash
Dontla9 小时前
git bash打开Claude code报错:Claude Code on Windows requires git-bash.(别把git装其他位置,严格按照默认安装)找不到claude code
windows·git·bash
weixin_462446239 小时前
手把手教你用 Bash 脚本自动更新 /etc/hosts —— 自动绑定网卡 IP 与节点名
开发语言·tcp/ip·bash
一个梦醒了9 小时前
安装git bash选项推荐
开发语言·git·bash
GIS数据转换器9 小时前
城市排水生命线安全运行监测平台深度解析
java·运维·人工智能·python·安全·数据挖掘·无人机