zoukankan      html  css  js  c++  java
  • 提升git clone的速度

    思路:

    (1)git clone特别慢是因为github.global.ssl.fastly.net域名被限制了。
    只要找到这个域名对应的ip地址,然后在hosts文件中加上ip–>域名的映射,刷新DNS缓存便可。

    (2)国内无法使用github分布加速服务器是DNS污染导致的,解决思路是向DNS本机域名解析缓冲中添加github的域名映射ip地址,通过https://www.ipaddress.com/查询的ip地址基本都分布在美国,测试时没有解决速度问题,通过http://site.ip138.com/www.github.com/这个网站查询网址对应的DNS解析地址。

    实施:

      在网站 https://www.ipaddress.com/ 分别搜索:(登录该网站,然后在里面输入下面两个URL地址,获取IP地址,简约版本可以只查询红色字体的地址进行解析)

    github.global.ssl.fastly.net
    github.com
    assets-cdn.github.com
    avatars0.githubusercontent.com
    documentcloud.github.com
    gist.github.com
    help.github.com
    nodeload.github.com
    raw.github.com
    status.github.com
    training.github.com
    www.github.com
    avatars0.githubusercontent.com
    avatars1.githubusercontent.com

    得到IP:

      
     
      
     
     
     
     
     
     
     
     
      2. 打开hosts文件
    • Windows上的hosts文件路径在C:WindowsSystem32driversetchosts
    • Linux的hosts文件路径在:sudo vim /etc/hosts
    windows下:用编辑器打开host文件: C:WindowsSystem32driversetchosts

    把下面两行加到host文件末尾(如果上面操作的IP地址git clone的速度依然很慢,那么我推荐使用下面的IP以及格式)

    151.101.72.249 github.global.ssl.fastly.net
    192.30.253.112 github.com

    vim操作方法:选择E编辑模式,然后输入I插入模式,输入内容,最后点击shift + ! 键进入命令保存模式   :wq

      3. 在hosts文件末尾添加两行(对应上面查到的ip):

    151.101.185.194 github.global.ssl.fastly.net
    192.30.253.112 github.com

      4. 保存更新DNS

    • Winodws系统的做法:打开CMD,输入ipconfig /flushdns
    • Linux的做法:在终端输入sudo /etc/init.d/networking restart

     细致一点的操作:

      在hosts文件下面增加github相关的域名和对应ip (具体IP地址需要自己查询)

     # Github

    192.30.253.113 github.com
    151.101.184.133 assets-cdn.github.com
    185.199.108.153 documentcloud.github.com
    192.30.253.118 gist.github.com
    185.199.108.153 help.github.com
    192.30.253.120 nodeload.github.com
    151.101.184.133 raw.github.com
    18.204.240.114 status.github.com
    192.30.253.166 training.github.com
    192.30.253.112 www.github.com
    151.101.185.194 github.global.ssl.fastly.net
    151.101.184.133 avatars0.githubusercontent.com
    151.101.184.133 avatars1.githubusercontent.com

    以管理员身份运行cmd(搜索cmd 然后右键管理员运行)

    执行ipconfig /flushdns


     win10记事本修改编辑hosts文件无法保存解决办法:https://jingyan.baidu.com/article/624e7459b194f134e8ba5a8e.html

    win10安装git:https://jingyan.baidu.com/article/20095761b48041cb0721b4fc.html

    本文相关参考链接https://www.zhihu.com/question/27159393
              https://www.jianshu.com/p/3f6477049ece
     
  • 相关阅读:
    Spark RDD简介与运行机制概述
    MongoDB 3.0.6的主,从,仲裁节点搭建
    kafka入门:简介、使用场景、设计原理、主要配置及集群搭建(转)
    Spark配置参数调优
    SparkSQL项目中的应用
    SparkSQL相关语句总结
    Hadoop系统架构
    Hadoop常用命令
    spark单机模式简单搭建
    Spark参数配置说明
  • 原文地址:https://www.cnblogs.com/iBoundary/p/12418440.html
Copyright © 2011-2022 走看看