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

安装cmake包时,提示报错

doubleq@doubleq1deMac-Studio build % arch -x86_64 brew install cmake
Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake
cmake 3.25.1 is already installed but outdated (so it will be upgraded).
==> Fetching cmake
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/manifests/3.25.2
Already downloaded: /Users/doubleq666/Library/Caches/Homebrew/downloads/ae537c7714c23df1aa42dae762968262495b132366bcd14648ad233e050f63db--cmake-3.25.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/blobs/sha256:f502d6ccb79b82ec25b2f4222c15d29e31fb906325ea80609d0e829ead9080f2
Already downloaded: /Users/doubleq666/Library/Caches/Homebrew/downloads/fc905a18b9e0586700a6e02c58c32f4fb1d5c52ee93bf1d87cc77e58fa5f965f--cmake--3.25.2.ventura.bottle.tar.gz
==> Upgrading cmake
  3.25.1 -> 3.25.2 

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

出错的原因是homebrew-corehomebrew-cask文件夹被被存放在了一个系统认为不安全的路径,需要手动将这两个路径指定为是安全的。

执行brew -v命令

doubleq@doubleq1deMac-Studio homebrew % brew -v
Homebrew 4.0.1-44-ga62112f
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)

复制运行两条建议的命令

doubleq@doubleq1deMac-Studio homebrew % git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
doubleq@doubleq1deMac-Studio homebrew % git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

就可以正常安装包了

doubleq@doubleq1deMac-Studio homebrew % arch -x86_64 brew install cmake                                                                 

==> Downloading https://formulae.brew.sh/api/formula.json
##O=#  #                                                                      
==> Downloading https://formulae.brew.sh/api/cask.json
##O=#  #                                                                      
Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake
cmake 3.25.1 is already installed but outdated (so it will be upgraded).
==> Fetching cmake
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/manifests/3.25.2
Already downloaded: /Users/doubleq666/Library/Caches/Homebrew/downloads/ae537c7714c23df1aa42dae762968262495b132366bcd14648ad233e050f63db--cmake-3.25.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/blobs/sha256:f502d6ccb79b82ec25b2f4222c15d29e31fb906325ea80609d0e829ead9080f2
Already downloaded: /Users/doubleq666/Library/Caches/Homebrew/downloads/fc905a18b9e0586700a6e02c58c32f4fb1d5c52ee93bf1d87cc77e58fa5f965f--cmake--3.25.2.ventura.bottle.tar.gz
==> Upgrading cmake
  3.25.1 -> 3.25.2 

==> Pouring cmake--3.25.2.ventura.bottle.tar.gz
==> Caveats
To install the CMake documentation, run:
  brew install cmake-docs

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cmake
==> Summary
🍺  /usr/local/Cellar/cmake/3.25.2: 3,167 files, 49MB
==> Running `brew cleanup cmake`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /usr/local/Cellar/cmake/3.25.1... (3,167 files, 49MB)
doubleq@doubleq1deMac-Studio homebrew % arch -x86_64 brew install lightgbm                                                              
==> Fetching dependencies for lightgbm: libomp
==> Fetching libomp
==> Downloading https://ghcr.io/v2/homebrew/core/libomp/manifests/15.0.7
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libomp/blobs/sha256:762c461db6af3cf78983b1eb58aee62699652b96237abf79469c8ac034b2156b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:762c461db6af3cf78983b1eb58aee62699652b96237abf79469c8ac034b2156b?se=2023-02-17
######################################################################## 100.0%
==> Fetching lightgbm
==> Downloading https://ghcr.io/v2/homebrew/core/lightgbm/manifests/3.3.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/lightgbm/blobs/sha256:515f6e0358450ecf2b8d1980c9f95879f79a6ed4bb17f87fdc6d4603a86234fd
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:515f6e0358450ecf2b8d1980c9f95879f79a6ed4bb17f87fdc6d4603a86234fd?se=2023-02-17
######################################################################## 100.0%
==> Installing dependencies for lightgbm: libomp
==> Installing lightgbm dependency: libomp
==> Pouring libomp--15.0.7.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/libomp/15.0.7: 7 files, 1.6MB
==> Installing lightgbm
==> Pouring lightgbm--3.3.5.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/lightgbm/3.3.5: 98 files, 18MB
==> Running `brew cleanup lightgbm`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DoubleQ666

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值