Linux下下载github代码,经常超时,有时候可通过更新host来解决。以下梳理总结几种更新 host的方法。
#方法一(openwrt,也利用于linux)
wget -q https://gitlab.com/ineo6/hosts/-/raw/master/next-hosts -O /tmp/new.txt --no-check-certificate
cat /tmp/new.txt /etc/hosts > /tmp/new1.txt
cp /tmp/new1.txt /etc/hosts
chmod 664 /etc/hosts
/etc/init.d/dnsmasq restart #仅wrt需要
#方法二:
sudo sed -i '/github/d' /etc/hosts
sudo bash -c "curl https://gitlab.com/ineo6/hosts/-/raw/master/next-hosts | grep github >> /etc/hosts"
The End.