当前位置:   article > 正文

Mac 电脑无法访问GitHub问题_mac访问github

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)

  1. cd /etc
  2. sudo chmod 777 hosts
  3. 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/’

  1. fatal: unable to access 'https://github.com/Homebrew/brew/': Recv failure: Operation timed out
  2. 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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/65573
推荐阅读
相关标签
  

闽ICP备14008679号