提升git clone速度

国内由于github.global.ssl.fastly.net域名被限制,导致本地clone远程的github仓库极慢,故采取以下几种方式解决:

  • 方式一:修改hosts

    CentOS7 环境

    1. 下载nslookup

      yum -y install bind-utils
      
    2. 查看github.global.ssl.fastly.Net的ip地址

      nslookup github.global.ssl.fastly.Net
      

      image-20220512105630870

    3. 修改hosts文件,添加域名映射

      vim /etc/hosts
      

      image-20220522110108207

      Windows 中hosts文件在 C:\Windows\System32\drivers\etc\ 目录下

    4. 刷新dns缓存

      安装nscd

      yum -y install nscd
      

      启动nscd服务

      systemctl start nscd
      

      设置nscd服务开机自启动(可选)

      systemctl enable nscd
      

      刷新 dns 缓存

      nscd -i host
      

      Windows 可在 cmd 中输入 ipconfig /flushdns 刷新dns缓存

posted @ 2022-05-22 10:40  InaRwi  阅读(131)  评论(0编辑  收藏  举报

阅读目录(Content)

此页目录为空