github使用技巧(经验篇)

FAQ

Q:github网页打不开?

【github加载不出来】github 加载不出来、打开网页乱码-获取GitHub官方CDN地址、修改系统Hosts文件 刷新缓存

用google chrome浏览器和搜狗浏览器访问 github.com 网站,都打不开网页,排除了浏览器的问题。

github.com 这个域名对应的IP地址有很多个,有些在我国允许访问的范围内,有些不在。当你的计算机通过DNS解析的github.com 对应的地址恰好在我国允许访问的范围内,你就可以访问,反之不能。

通常情况下,多刷新几次浏览器,DNS多解析几次,就有可能会正常打开github。但是过不了多久,又会出现同样的问题。解决办法是,只需要将访问的 github.com 固定解析到一个国内可以访问的IP地址上就行。

获取github官方DSN地址

打开 IPADDRESS.COM ,右上角搜索查找以下三个DNS地址:

bash 复制代码
http://github.com 
http://assets-cdn.github.com http://github.global.ssl.fastly.net

http://github.com

http://assets-cdn.github.com

http://github.global.ssl.fastly.net

修改系统 hosts 文件

hosts 文件在每个系统的位置不一,详情如下:

  • Windows 系统:C:\Windows\System32\drivers\etc\hosts

  • Linux 系统:/etc/hosts

  • Mac(苹果电脑)系统:/etc/hosts

  • Android(安卓)系统:/system/etc/hosts

  • iPhone(iOS)系统:/etc/hosts

在hosts文件末尾,添加dns内容:

bash 复制代码
140.82.113.4 github.com

185.199.108.153 assets-cdn.github.com 
185.199.109.153 assets-cdn.github.com 
185.199.110.153 assets-cdn.github.com 
185.199.111.153 assets-cdn.github.com 

151.101.1.194 github.global.ssl.fastly.net 
151.101.65.194 github.global.ssl.fastly.net 
151.101.129.194 github.global.ssl.fastly.net 
151.101.193.194 github.global.ssl.fastly.net 

如果hosts文件没有修改权限,则修改权限。修改完之后,记得把权限改回来。

右击hosts文件->属性->安全->编辑->在组或用户名栏中选中Users->写入

刷新dns缓存

bash 复制代码
ipconfig /flushdns

重新打开网页

关闭浏览器,重新打开github,github网页乱码问题已解决。

Q:github网页乱码?

用google chrome浏览器和搜狗浏览器访问github网站,都显示乱码,排除了浏览器的问题。

修改系统hosts文件

在hosts文件末尾,添加以下内容:

bash 复制代码
# GitHub IP地址
140.82.121.4 github.com

185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com

185.199.108.133 objects.githubusercontent.com
185.199.109.133 objects.githubusercontent.com
185.199.110.133 objects.githubusercontent.com
185.199.111.133 objects.githubusercontent.com

185.199.108.154 github.githubassets.com
185.199.109.154 github.githubassets.com
185.199.110.154 github.githubassets.com
185.199.111.154 github.githubassets.com

其余步骤与【"github网页打不开"问题】的解决办法一致,此处不再赘述。

相关推荐
HelloGitHub1 小时前
他没买 iPad,而是花了半年时间,为所有“穷学生”写了个笔记神器
开源·github
我是一只代码狗18 小时前
idea中使用git
git·gitee·github
产品经理独孤虾20 小时前
GitHub Copilot:产品经理提升工作效率的AI助手
github·copilot·产品经理·原型设计·ai工具·效率提升·prd
杜莱1 天前
IDEA 安装AI代码助手GitHub Copilot和简单使用体验
人工智能·github·intellij-idea
LogicFlow1 天前
对单调的画布说拜拜👋🏻
前端框架·开源·github
強云1 天前
使用 SSH 连接 GitHub
ssh·github
这里有鱼汤1 天前
🚀逆天神器来了!MCP Chrome:超越Playwright,让AI接管你的浏览器,我当场震撼!
github·mcp
独立开阀者_FwtCoder1 天前
前端开发的你,其实并没有真的掌握img标签!
前端·vue.js·github
草梅友仁2 天前
手机号注册登录功能开发 | 2025 年第 28 周草梅周报
开源·github·ai编程