国内无法访问GitHub官网的问题解决
作为一名程序员,在国内访问GitHub官网经常会遇到打开过慢或者访问失败的问题,但通过一些技巧可以改善访问体验。GitHub访问问题的根源在于GitHub官网访问不稳定的主要原因在于DNS解析过程。当我们直接访问github.com时,需要通过DNS服务器将域名转换为对应的IP地址。由于某些原因,这个解析过程在国内可能会变得缓慢或不稳定,导致有时能打开,有时无法访问,或者加载速度极慢。本文通过介绍修改Hosts文件解决GitHub访问过慢或者打不开的为标题
1.打开dns查询 - bejson在线工具,输入“https://github.com” 解析域名
2.修改C:\Windows\System32\drivers\etc下的hosts文件
3.启动命令运行窗口,运行命令:ipconfig/flushdns ,刷新DNS缓存。
4.验证配置是否生效,命令运行窗口,运行命令:ping github.com,如下图说明配置成功
5.浏览器访问https://github.com/可以正常访问,如无法访问可以重启电脑试试
6.下面是git相关的域名和DNS解析,也可访问https://raw.hellogithub.com/hosts直接下载
# GitHub520 Host Start
140.82.112.25 alive.github.com
20.205.243.168 api.github.com
140.82.114.21 api.individual.githubcopilot.com
185.199.110.133 avatars.githubusercontent.com
185.199.110.133 avatars0.githubusercontent.com
185.199.110.133 avatars1.githubusercontent.com
185.199.110.133 avatars2.githubusercontent.com
185.199.110.133 avatars3.githubusercontent.com
185.199.110.133 avatars4.githubusercontent.com
185.199.110.133 avatars5.githubusercontent.com
185.199.110.133 camo.githubusercontent.com
140.82.114.21 central.github.com
185.199.110.133 cloud.githubusercontent.com
20.205.243.165 codeload.github.com
140.82.114.22 collector.github.com
185.199.110.133 desktop.githubusercontent.com
185.199.110.133 favicons.githubusercontent.com
20.205.243.166 gist.github.com
54.231.160.73 github-cloud.s3.amazonaws.com
16.182.107.177 github-com.s3.amazonaws.com
16.182.33.73 github-production-release-asset-2e65be.s3.amazonaws.com
3.5.28.170 github-production-repository-file-5c1aeb.s3.amazonaws.com
54.231.197.177 github-production-user-asset-6210df.s3.amazonaws.com
192.0.66.2 github.blog
20.205.243.166 github.com
140.82.112.18 github.community
185.199.108.154 github.githubassets.com
151.101.193.194 github.global.ssl.fastly.net
185.199.108.153 github.io
185.199.110.133 github.map.fastly.net
185.199.108.153 githubstatus.com
140.82.113.25 live.github.com
185.199.110.133 media.githubusercontent.com
185.199.110.133 objects.githubusercontent.com
13.107.42.16 pipelines.actions.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.110.133 user-images.githubusercontent.com
13.107.246.73 vscode.dev
140.82.113.22 education.github.com
185.199.110.133 private-user-images.githubusercontent.com# Update time: 2025-04-29T12:07:30+08:00
# Update url: https://raw.hellogithub.com/hosts
# Star me: https://github.com/521xueweihan/GitHub520
# GitHub520 Host End