问题描述
mac m1使用brew装tree时,报错如下:
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-services' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-services
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-services' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-services
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-services' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-services
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-services' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-services
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/tree-1.8.0.arm64_monterey.bottle.tar.gz
curl: (22) The requested URL returned error: 404
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/tree/manifests/1.8.0
Already downloaded: /Users/wliang/Library/Caches/Homebrew/downloads/50ac34dbf0d30c786b9255ea5de2d02ba4fc68733b8030e3cbb19ce982d20200--tree-1.8.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/tree/blobs/sha256:ef081c81d87232951eff9f5bed6a589dbe3bd2b16f59e7ae28fdcc5351882429
Already downloaded: /Users/wliang/Library/Caches/Homebrew/downloads/99c1ff68d2ecd33583f4573c655a1eaeccce24d5550b9ece2078af3a58c5a40f--tree--1.8.0.arm64_monterey.bottle.tar.gz
fatal: not in a git directory
Error: Command failed with exit 128: git
brew -v显示
Homebrew 3.3.7-38-g6295b08
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: unsafe repository ('/opt/homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)
解决方案
按提示直接输入下列命令
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
在MacM1上尝试使用brew安装tree时遇到权限错误,提示'unsaferpository'。解决方案是通过运行git配置命令添加安全目录例外,如:`git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core`等。执行这些命令后,尝试重新安装tree。

3144

被折叠的 条评论
为什么被折叠?



