*这是由Google Adsense推荐的一个广告,并不代表本站的观点。

由于我们大天朝有墙,许多国外网站拒之门外,而XHub被这个墙误伤,中国大陆境内非常缓慢,所以才出现了这篇文章

方法1.换gitee呗,中国的XHub

方法2.

先去https://tool.chinaz.com/dns查询一下XHub的IP地址

直通车 https://tool.chinaz.com/dns?type=1&host=github.com&ip=

然后你把tw(中华电信)的IP复制好,备用

Windows版本

打开资源管理器,输入C:\Windows\System32\drivers\etc\

里面找到hosts文件,拖到桌面上

然后用记事本编辑

往后面加入以下的东西

#GitHub Start 
151.101.100.133 assets-cdn.github.com 
151.101.100.133 raw.githubusercontent.com 
151.101.100.133 gist.githubusercontent.com 
151.101.100.133 cloud.githubusercontent.com 
151.101.100.133 camo.githubusercontent.com 
151.101.100.133 user-images.githubusercontent.com
151.101.100.133 avatars0.githubusercontent.com 
151.101.100.133 avatars1.githubusercontent.com 
151.101.100.133 avatars2.githubusercontent.com 
151.101.100.133 avatars3.githubusercontent.com 
151.101.100.133 avatars4.githubusercontent.com 
151.101.100.133 avatars5.githubusercontent.com 
151.101.100.133 avatars6.githubusercontent.com 
151.101.100.133 avatars7.githubusercontent.com 
151.101.100.133 avatars8.githubusercontent.com 
# GitHub End

这里的151.101.100.133要换成你的那个IP,否则毛用也没有

然后拖回原地址

途中可能会向你要管理员权限,给它就行

然后就没有了

Linux版

如果执行vim报错你可以尝试执行这个

vi /etc/hosts

如果vi也没用,这里还有个最老土的方法

echo "#GitHub Start ">> /etc/hosts
echo "151.101.100.133 assets-cdn.github.com ">> /etc/hosts
echo "151.101.100.133 raw.githubusercontent.com ">> /etc/hosts
echo "151.101.100.133 gist.githubusercontent.com ">> /etc/hosts
echo "151.101.100.133 cloud.githubusercontent.com ">> /etc/hosts
echo "151.101.100.133 camo.githubusercontent.com ">> /etc/hosts
echo "151.101.100.133 user-images.githubusercontent.com ">> /etc/hosts
echo "151.101.100.133 avatars0.githubusercontent.com">> /etc/hosts
echo "151.101.100.133 avatars1.githubusercontent.com">> /etc/hosts
echo "151.101.100.133 avatars2.githubusercontent.com">> /etc/hosts
echo "151.101.100.133 avatars3.githubusercontent.com">> /etc/hosts
echo "151.101.100.133 avatars4.githubusercontent.com">> /etc/hosts
echo "151.101.100.133 avatars5.githubusercontent.com">> /etc/hosts
echo "151.101.100.133 avatars6.githubusercontent.com">> /etc/hosts
echo "151.101.100.133 avatars7.githubusercontent.com">> /etc/hosts
echo "151.101.100.133 avatars8.githubusercontent.com">> /etc/hosts
echo "# GitHub End">> /etc/hosts

如果你想要vim,你可以考虑输入以下命令

//Debian&Deepin&Ubuntu
apt-get install vim
//CentOS&Fodera&RHEL
yum install vim

好了

正片开始

首先输入

vim /etc/hosts

如果没有权限的记得sudo

然后按i

插入刚刚那个东西

#GitHub Start 
151.101.100.133 assets-cdn.github.com 
151.101.100.133 raw.githubusercontent.com 
151.101.100.133 gist.githubusercontent.com 
151.101.100.133 cloud.githubusercontent.com 
151.101.100.133 camo.githubusercontent.com 
151.101.100.133 user-images.githubusercontent.com
151.101.100.133 avatars0.githubusercontent.com 
151.101.100.133 avatars1.githubusercontent.com 
151.101.100.133 avatars2.githubusercontent.com 
151.101.100.133 avatars3.githubusercontent.com 
151.101.100.133 avatars4.githubusercontent.com 
151.101.100.133 avatars5.githubusercontent.com 
151.101.100.133 avatars6.githubusercontent.com 
151.101.100.133 avatars7.githubusercontent.com 
151.101.100.133 avatars8.githubusercontent.com 
# GitHub End

最后输入好了

可以按ESC键(就是你键盘左上角的那个)

然后按:wq退出就行www


科技为主,游戏为辅。技术肥宅,喜欢看番。