Mac 电脑无法访问GitHub问题

目录

1.mac电脑无法访问github官网的原因

2.解决方法

3.访问成功界面

4.github速度慢问题

5.安装Homebrew时遇到ERROR  fatal: unable to access ‘https://github.com/Homebrew/brew/’

6.使用homebrew安装git 


1.mac电脑无法访问github官网的原因

可以参考:深入分析GitHub不能访问的原因及解决方案_笔记大全_设计学院

2.解决方法

1、获取github.com的ip

方法一:

直接在终端输入命令

ping github.com

效果如下:

方法二:

效果如下:

2、修改hosts文件,文件位置 /etc/hosts ;

在电脑的hosts文最后一行加上

20.205.243.166 github.com

备注:如果无法修改,可能是文件没有写入权限,依次执行下面的命令后再加上,最后记得保存退出. (:wq)

cd /etc

sudo chmod 777 hosts

vi hosts

3.访问成功界面

貌似还存在代码上传下载速度慢的问题~

4.github速度慢问题

  • 进入网站:Dns检测|Dns查询 - 站长工具​​​​​​​
  • 在A类型里面输入:github.global.ssl.fastly.net ,点击“检测”;
  • 在hosts文件最后一行加上
103.228.130.27 http://github.global.ssl.fastly.net

5.安装Homebrew时遇到ERROR  fatal: unable to access ‘https://github.com/Homebrew/brew/’

fatal: unable to access 'https://github.com/Homebrew/brew/': Recv failure: Operation timed out
Failed during: /usr/bin/git fetch --force --tags origin

​​​​​​​

可以执行下面命令

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

即可解决

6.使用homebrew安装git 

brew install git

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>