brew install carthage報錯:
~ % brew install carthage
fatal: not in a git directory
Warning: No remote 'origin' in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask, skipping update!
fatal: not in a git directory
Warning: No remote 'origin' in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core, skipping update!
fatal: not in a git directory
Warning: No remote 'origin' in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/carthage-0.
Already downloaded: /Users/zhjch/Library/Caches/Homebrew/downloads/60e742acea5cf0209980e5b24fa584df489180e83397778e5ef9d002041d13dd--carthage-0.38.0.monterey.bottle.tar.gz
fatal: not in a git directory
Error: Command failed with exit 128: git
解決辦法:
執(zhí)行命令brew-v根欧,會有如下提示脚猾,提示用戶設(shè)置設(shè)置homebrew-core和homebrew-cask的文件路徑為safe.directory
~ % brew -v
Homebrew 3.5.10-74-gd5b9d0e
fatal: detected dubious ownership in repository at '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'
To add an exception for this directory, call:
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: detected dubious ownership in repository at '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'
To add an exception for this directory, call:
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)
即執(zhí)行如下命令:
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask
之后再執(zhí)行 brew install carthage即可。