美文网首页
fatal: not in a git directory Er

fatal: not in a git directory Er

作者: 雪贝壳 | 来源:发表于2023-03-15 21:54 被阅读0次

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

解决办法:
执行命令brew-v,会有如下提示,提示用户设置设置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)

即执行如下命令:

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

之后再执行 brew install carthage即可。

相关文章

网友评论

      本文标题:fatal: not in a git directory Er

      本文链接:https://www.haomeiwen.com/subject/ilkrrdtx.html