• Git Clone download project from CentOS server is slow or times out

    [root @ VM - 0-11 - centos home] # git clone https://github.com/dengzemiao/DZMLuckyDraw.git is clone to 'DZMLuckyDraw'... error: RPC failed; result=35, HTTP code = 0 fatal: The remote end hung up unexpectedlyCopy the code
  • Git clone particularly slow, because the domain name github.global.ssl.fastly.net is limited, as long as the IP address of the corresponding find this domain name, then add the IP in the hosts file – > domain mapping, DNS cache refresh.

  • The nslookup command is used to obtain the GIthub IP address

    1, if not installed, then need to install

    $ yum -y install bind-utils
    Copy the code

    2. Obtain the IP address

    $ nslookup github.global.ssl.fastly.net
    $ nslookup github.com
    Copy the code

  • Modifying the hosts File

    1. Edit hosts

    $ sudo vim /etc/hosts
    Copy the code

    2, fill in the content, save

    Format: X.X.X.X http://global-ssl.fastly.net X.X.X.X http://github.com for example, take the IP address above: 69.171.229.73 13.250.177.223 http://global-ssl.fastly.net http://github.comCopy the code

  • The NSCD command updates the DNS cache

    1, if not installed, then need to install

    $ yum install -y nscd
    Copy the code

    2. Update the DNS cache

    $ nscd -i hosts
    Copy the code
  • Then execute Git Clone again, it will enter download.

    [root @ VM - 0-11 - centos home] # git clone https://github.com/dengzemiao/DZMLuckyDraw.git is clone to 'DZMLuckyDraw'... remote: Enumerating objects: 2644, done. remote: Counting objects: 100% (2644/2644), done. remote: Compressing objects: 100% (1562/1562), done. Receiving object: 1% (41/2644), 897.00 KiB | 897.00 KiB/sCopy the code