解决国内云服务器无法访问GitHub联机下载文件的问题,由于新购买的一台国内服务器需要联网GitHub部署环境,但是发现国内服务器居然无法连接 raw.githubusercontent.com 于是在网上找了一下方法,下面给大家分享出来,自己也记录一下。

WordPress

使用SSH终端管理软件连接好服务器,将下面的记录放到服务器端的Hosts文件中,在Linux系统中,Hosts文件的位置在 /etc 目录下,直接写进去即可。

复制
vi /etc/hosts
输入i编辑

对Hosts文件进行编辑,将下面的记录添加到Hosts文件最后位置
20.205.243.166 github.com
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
199.232.68.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
151.101.76.133 raw.githubusercontent.com
151.101.108.133 raw.githubusercontent.com
151.101.228.133 raw.githubusercontent.com
151.101.128.133 raw.githubusercontent.com
151.101.0.133 raw.githubusercontent.com

:wq保存
reboot重启
保存退出并重启,然后重新使用 wget 获取文件就可以了。

Logo

鸿蒙生态一站式服务平台。

更多推荐