GitHub - 电脑无法访问GitHub

配置好的host地址:

手动自己找是比较繁琐的,这里分享一个代码,自动生成Hosts
某大佬分享的仓库:
https://github.com/521xueweihan/GitHub520
hosts文件:https://raw.hellogithub.com/hosts
JSON:https://raw.hellogithub.com/hosts.json

自己手动配置

通过下面网址查询最新的IP地址:
https://github.com.ipaddress.com

https://www.ipaddress.com

然后配置到host中

202103 IP地址为:140.82.112.3

windows:

Windows电脑有时打不开GitHub,修改host文件即可

https://www.jianshu.com/p/3eacebfc55ab
https://www.cnblogs.com/Java-Script/p/11090777.html

host文件修改方法:

找到host文件路径:

C:\WINDOWS\System32\drivers\etc

在最后添加host

#github
192.30.253.112 github.com
151.101.113.194 github.global.SSL.fastly.net

dns刷新,打开cmd:

ipconfig /flushdns

注:
192.30.253.112是查找的github的网址
151.101.113.194是查找github.global.ssl.fastly.net网址

另外一种方式

1.打开Dns检测|Dns查询 - 站长工具
2.在检测输入栏中输入http://github.com官网
3.把检测列表里的TTL值最小的IP输入到hosts里,并对应写上github官网域名

https://github.com.ipaddress.com

Mac :

host路径

/private/etc

hosts文件位置:/etc/hosts。

macOS系统下修改需要按照如下方式:

1:首先,打开(访达)Finder。
2:使用组合键Shift+Command+G打开"前往文件夹",输入框中输入/etc/hosts。
3:然后就会跳转到hosts文件位置。

注意:如果你使用VS Code,可以直接用VS Code修改和保存。
复制hosts文件到桌面上,鼠标右键右击它,选择「打开方式」—「文本编辑」,打开这个hosts文件,然后将你要修改的内容直接在里面修改就好了。

然后把你修改好的hosts文件替换掉:/etc/hosts 文件。

注意:如果弹出密码输入框,你需要输入你当前电脑登录账号的密码。

最后刷新缓存:

sudo killall -HUP mDNSResponder

添加网址到 host

# GitHub Start 

192.30.253.112 Build software better, together 
140.82.113.4 gist.github.com
151.101.184.133 assets-cdn.github.com
151.101.184.133 raw.githubusercontent.com
151.101.184.133 gist.githubusercontent.com
151.101.184.133 cloud.githubusercontent.com
151.101.184.133 camo.githubusercontent.com
151.101.184.133 avatars0.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
151.101.184.133 avatars3.githubusercontent.com
151.101.184.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
151.101.184.133 avatars8.githubusercontent.com
199.232.96.133 user-images.githubusercontent.com

# GitHub End

202208

# GitHub Start 
140.82.114.3 github.com
140.82.114.4 gist.github.com
151.101.1.194 github.global.SSL.fastly.net
185.199.109.153 assets-cdn.github.com
185.199.108.133 raw.githubusercontent.com
185.199.108.133 gist.githubusercontent.com
185.199.108.133 cloud.githubusercontent.com
185.199.108.133 camo.githubusercontent.com
185.199.108.133 avatars0.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars3.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.108.133 avatars5.githubusercontent.com
185.199.108.133 avatars6.githubusercontent.com
185.199.108.133 avatars7.githubusercontent.com
185.199.108.133 avatars8.githubusercontent.com
185.199.108.133 user-images.githubusercontent.com

# GitHub End
  • 17
    点赞
  • 97
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值