提升git clone速度
国内由于github.global.ssl.fastly.net域名被限制,导致本地clone远程的github仓库极慢,故采取以下几种方式解决:
-
方式一:修改hosts
CentOS7 环境
-
下载nslookup
yum -y install bind-utils
-
查看github.global.ssl.fastly.Net的ip地址
nslookup github.global.ssl.fastly.Net
-
修改hosts文件,添加域名映射
vim /etc/hosts
Windows 中hosts文件在 C:\Windows\System32\drivers\etc\ 目录下
-
刷新dns缓存
安装nscd
yum -y install nscd
启动nscd服务
systemctl start nscd
设置nscd服务开机自启动(可选)
systemctl enable nscd
刷新 dns 缓存
nscd -i host
Windows 可在 cmd 中输入 ipconfig /flushdns 刷新dns缓存
-