引起这个的原因是因为github.com是海外网站,国内DNS受到干扰等原因导致无法访问
解决方法
- 获取最新可用 IP, 浏览器中访问 https://raw.hellogithub.com/hosts 通过这个可以获得IP列表
- 编辑 hosts 文件
- Windows:
C:\Windows\System32\drivers\etc\hosts(需管理员权限) - macOS/Linux:
/etc/hosts
- Windows:
- 添加第一步获得的IP列表到末尾
- GitHub520 Host Start
- 140.82.112.26 alive.github.com
- 140.82.114.6 api.github.com
- 140.82.113.22 api.individual.githubcopilot.com
- 185.199.111.133 avatars.githubusercontent.com
- 185.199.111.133 avatars0.githubusercontent.com
- ……
- Update time: 2026-03-05T15:53:05+08:00
- Update url: https://raw.hellogithub.com/hosts
- Star me: https://github.com/521xueweihan/GitHub520
- GitHub520 Host End
- 保存后刷新 DNS 缓存
- Windows:
ipconfig /flushdns - macOS:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Linux:
sudo systemd-resolve --flush-caches
- Windows:
