mac 使用brew install 安装工具 Error: Command failed with exit 128: git

使用brew安装golang时出现,Error: Command failed with exit 128: git

$  brew install go
==> Fetching go
==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/go-1.19.4.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
fatal: not in a git directory
Error: Command failed with exit 128: git

解决办法

$ brew doctor

brew doctor

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Suspicious https://github.com/Homebrew/brew git origin remote found.
The current git origin is:
  https://mirrors.aliyun.com/homebrew/brew.git

With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
  git -C "/opt/homebrew" remote set-url origin https://github.com/Homebrew/brew

Warning: Homebrew/homebrew-cask was not tapped properly! Run:
  rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-cask"
  brew tap homebrew/cask

Warning: Homebrew/homebrew-core was not tapped properly! Run:
  rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
  brew tap homebrew/core

根据提示处理即可

  1. 执行1
$ git -C "/opt/homebrew" remote set-url origin https://github.com/Homebrew/brew
  1. 执行2
$ rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-cask"
$ brew tap homebrew/cask
  1. 执行3
$ rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
$ brew tap homebrew/core

完美解决

$ brew install go
==> Fetching go
==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/go-1.19.4.arm64_ventu
Already downloaded: /Users/4wheels/Library/Caches/Homebrew/downloads/56740eebcb6f4b0859fe3baa5914a4bd2a7a2216f6b10a525dd5e5f24f69ad36--go-1.19.4.arm64_ventura.bottle.tar.gz
==> Pouring go-1.19.4.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/go/1.19.4: 12,452 files, 629.1MB
==> Running `brew cleanup go`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
$ go version
go version go1.19.4 darwin/arm64
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值