HomeBrew报错问题

43 阅读1分钟

一 、fatal: not in a git directory

fatal: not in a git directory

Warning: No remote 'origin' in /opt/homebrew, skipping update!

error: cannot open '.git/FETCH_HEAD': Permission denied

fatal: not in a git directory

Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!

error: cannot open '.git/FETCH_HEAD': Permission denied

Error: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-cask failed!

Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core failed!

==> **Homebrew has enabled anonymous aggregate formula and cask analytics.**

**Read the analytics documentation (and how to opt-out) here:**

******https://docs.brew.sh/Analytics**

No analytics have been recorded yet (nor will be during this `brew` run).

执行brew -v 命令看看是不是有两个提示,你的 homebrew-core和homebrew-cask目录 被git认为不是一个安全的目录,需要手动添加

git config --global --add safe.directory 你的homebrew-core路径

git config --global --add safe.directory 你的homebrew-cask路径

我的路径是

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