💡
原文中文,约800字,阅读约需2分钟。
📝
内容提要
本文介绍了国内访问 GitHub 出现错误的原因和解决方法,即 DNS 污染和在本机的 host 文件中添加 GitHub 的 IP 地址。同时,提供了在 Linux 下的操作方法,并推荐使用 IPAddress 查询域名的 IP。
🎯
关键要点
- 国内访问 GitHub 出现错误的原因是 DNS 污染。
- 错误示例:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused。
- 解决方法是在本机的 host 文件中添加 GitHub 的 IP 地址。
- 需要添加的 IP 地址包括:199.232.68.133 raw.githubusercontent.com、199.232.68.133 user-images.githubusercontent.com、199.232.68.133 avatars2.githubusercontent.com、199.232.68.133 avatars1.githubusercontent.com。
- Windows 系统的 host 文件路径为 C:\Windows\System32\drivers\etc,Linux 系统的路径为 /etc/hosts。
- 在 Linux 下的操作方法包括打开终端、编辑 hosts 文件并添加 IP 地址。
- 推荐使用 IPAddress 查询域名的 IP 地址。
➡️