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

只需要运行

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

然后再次安装,即可。