brew git错误

fatal: not in a git directory
Error: Command failed with exit 128: git

首先 网上说的那个git config 是没用的,我是在brew -v 正常的情况下,出现这个错误的,

所以,继续搜索...

解决:
执行 brew doctor,然后按照提示,把所有的warnning消除掉,然后就正常了

brew doctor
Your system is ready to brew.

brew update --verbose
Checking if we need to fetch /opt/homebrew/Homebrew...
Fetching /opt/homebrew/Homebrew...
Checking if we need to fetch formula.jws.json...
Checking if we need to fetch cask.jws.json...
Checking if we need to fetch formula_tap_migrations.jws.json...
Checking if we need to fetch cask_tap_migrations.jws.json...
Already up-to-date.

m1 macbook(arm版通用)安装brew

安装:
cd /opt/homebrew/

/bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"

消除告警:
git config --global --add safe.directory /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-core git config --global --add safe.directory /opt/homebrew/Homebrew/Library/Taps/homebrew/homebrew-cask

最后将brew路径写入shell配置 .zshrc
export PATH=$PATH:/opt/homebrew/bin