其他分享
首页 > 其他分享> > Mac 安装 Homebrew 出错 Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

Mac 安装 Homebrew 出错 Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

作者:互联网

今天在 Mac 装 Homebrew 遇到了一个问题,在网上找了大量解决方案,做个总结。

Mac 版本 High Sierra 10.13.6。

问题描述

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fatal: unable to access 'https://github.com/Homebrew/brew/': Could not resolve host: github.com
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force
ping github.com 
ING github.com (13.250.177.223): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3

解决方案

  1. 修改 host 配置,在终端中输入下列指令,打开编辑文件。
sudo vi /etc/hosts
  1. 按 s 进入编辑模式,在最下面添加 192.30.253.113 github.com
  2. 按control + c 保存,接着按:wq退出即可。
  3. 再次尝试在终端 ping github.com,发现已经成功了。
PING github.com (192.30.253.113): 56 data bytes
64 bytes from 192.30.253.113: icmp_seq=0 ttl=49 time=351.766 ms
64 bytes from 192.30.253.113: icmp_seq=1 ttl=49 time=388.017 ms
64 bytes from 192.30.253.113: icmp_seq=2 ttl=49 time=391.047 ms
64 bytes from 192.30.253.113: icmp_seq=3 ttl=49 time=408.031 ms
  1. 接着继续在终端输入官网的安装指令,就能安装成功了。
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

常见问题

error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: The remote end hung up unexpectedly

标签:origin,git,seq,bytes,253.113,github,master,icmp,com
来源: https://www.cnblogs.com/divebombchen/p/10491844.html