GitHub上不去怎么办?(登录超时网页显示不全)

1. 最近几天不知何故Github莫名的上不去了,而同一个网络在手机上却可以上去,查询之后说可以修改hosts

GitHub上不去怎么办?(登录超时网页显示不全)_第1张图片

图片知乎链接:https://www.zhihu.com/question/20732532/answer/138683232

2. 打开Dns检测|Dns查询 - 站长工具

按照第一步,输入github.com,找到了可以ping 的通的ip

192.30.253.112

192.30.253.113

192.30.253.118

192.30.253.119

任选一个写入hosts文件,Ubuntu下hosts文件在/etc下:

(Windows 系统hosts位于 C:\Windows\System32\drivers\etc\hosts)注意需要管理员权限。

sun@sun-pc:~$ sudo gedit /etc/hosts
127.0.0.1	localhost
127.0.1.1	sun-pc

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

# GitHub Start
192.30.253.112 github.com

保存hosts,断开网络链接,然后重新联网,打开github主页,如果打开正常,ok了。下面请忽略!

3.如果登录出现页面布局混乱,或超时如下图

GitHub上不去怎么办?(登录超时网页显示不全)_第2张图片

那么就可以使用HOSTS加速对Github网站加载的资源网站域名解析。操作如下,再次打开hosts文件:

127.0.0.1	localhost
127.0.1.1	sun-pc

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

# GitHub Start
192.30.253.112 github.com
192.30.253.119 gist.github.com
151.101.100.133 assets-cdn.github.com
151.101.100.133 raw.githubusercontent.com
151.101.100.133 gist.githubusercontent.com
151.101.100.133 cloud.githubusercontent.com
151.101.100.133 camo.githubusercontent.com
151.101.100.133 avatars0.githubusercontent.com
151.101.100.133 avatars1.githubusercontent.com
151.101.100.133 avatars2.githubusercontent.com
151.101.100.133 avatars3.githubusercontent.com
151.101.100.133 avatars4.githubusercontent.com
151.101.100.133 avatars5.githubusercontent.com
151.101.100.133 avatars6.githubusercontent.com
151.101.100.133 avatars7.githubusercontent.com
151.101.100.133 avatars8.githubusercontent.com
# GitHub End

保存hosts,断网重新连接,就ok了。参考链接:Github网站加载不完全,响应超时,如何解决

亲试可行,enjoy your github!

GitHub上不去怎么办?(登录超时网页显示不全)_第3张图片

ps:IP归属地查询网站

你可能感兴趣的:(Ubuntu系统)