Guide to Boosting GitHub Download Speeds with Proxies and CDN Acceleration

Overview

If you are downloading large projects, such as those that take more than 5 minutes or exceed 30 MB, it is highly recommended to use proxy sites, switch to gitee, or employ CDN acceleration for downloading.

If you are just downloading smaller projects, such as code-based or document-based projects, using CDN acceleration to increase speeds to over 100 KB/s should suffice.

1. Using Mirror Sites

For example: using a GitHub mirror site: http://cnpmjs.org

Original address:

https://github.com/xxx.git

Replace with:

https://github.com.cnpmjs.org/xxx.git

Example:

git clone https://github.com.cnpmjs.org/xxx.git

In short, just add .cnpmjs.org after http://github.com

Common Mirror Sites

Recommended: https://hub.fastgit.xyz/

Recommended

Website

Operation

 

https://hub.fastgit.xyz/ or https://hub.fastgit.org/

git clone https://hub.fastgit.xyz/……

 

https://hub.おうか.tw/

git clone https://hub.xn--p8jhe.tw/……

 

https://hub.連接.台灣/

git clone https://hub.xn--gzu630h.xn--kpry57d/……

 

https://cdn.githubjs.cf/

Can view, but not git

 

https://gitclone.com/

git clone https://gitclone.com/github.com/……

 

https://www.github.do/

git clone https://github.do/https://github.com/……

 

https://ghproxy.com/

git clone https://ghproxy.com/https://github.com/……

2. Use Proxy Sites to Download

For downloading large files in GitHub releases, proxy websites are recommended, boosting speeds without registration, personally tested effective.

Recommended:

https://ghproxy.com

https://toolwa.com/github

3. CDN Acceleration (Modify Hosts File) — Recommended

By modifying the system hosts file, bypass domestic DNS resolution and directly access GitHub’s CDN nodes to accelerate GitHub access. No foreign server assistance is needed.

There are many reasons why GitHub access speed is slow domestically, but the most direct and main reason is DNS pollution on GitHub’s distributed acceleration network domain, which causes lengthy downloads from the website, sometimes leading to failure requiring restarts, with multiple failures also causing IP restrictions due to excessive access attempts, which is frustrating.

To achieve the above requires three steps

  1. Obtain GitHub official CDN addresses
  2. Modify the system Hosts file
  3. Refresh the system DNS cache

1. Obtain GitHub Official CDN Addresses

First, open https://www.ipaddress.com/

Query DNS resolution addresses for the following 4 links

github.comassets-cdn.github.comgithub.global.ssl.fastly.netraw.githubusercontent.com

2. Modify System Hosts File

Then, open the system hosts file (requires administrator privileges).Path: C:\Windows\System32\drivers\etc

For Mac or other Linux systems, it’s the hosts file under /etc, which needs root user modification.

140.82.114.3 github.com185.199.108.153 assets-cdn.github.com199.232.69.194  github.global.ssl.fastly.net185.199.108.133 raw.githubusercontent.comecho "140.82.114.3 github.com185.199.108.153 assets-cdn.github.com199.232.69.194  github.global.ssl.fastly.net185.199.108.133 raw.githubusercontent.com185.199.108.154 github.githubassets.com" >> /etc/hosts 

And add three lines of records at the end and save (requires administrator privileges, be sure there is a space between IP address and domain name).

3. Refresh System DNS Cache

Finally, open the system command line (administrator account) or PowerShell using Windows+X

Run ipconfig /flushdns to manually refresh the system DNS cache.

For Mac systems, saving and exiting the hosts file is sufficient. No extra refresh step needed.For CentOS systems, execute /etc/init.d/network restart command to make the hosts effective.

4. Switch to gitee for Acceleration

Final download speed comparison

GitHub 42KB/s (after adding GitHub access cdn)

gitee 1034KB/s approximately 25 times the speed of GitHub

Example: We want to download https://github.com/DoubleLabyrinth/navicat-keygen

First, visit the address of the repository you want to download (in chrome

Click fork (this will copy the repository to your GitHub account, so you need a GitHub account, register if you don’t have one, log in if you do)

After clicking

Note that this repository is now under our name

Okay, we have temporarily finished the GitHub side of things

Now, log in to gitee (register an account if you don’t have one)

Then click

A grant will appear

You may need to enter your password the first time

Enter the Mac login password here and click Always Allow

Enter your github account password next

Select our recent project navicat-keygen -> Import

gitee is helping us download from GitHub (gitee’s download speed from GitHub must be fast, after all, it’s a big site)

It should be handled automatically within 30 seconds

Then we copy this URL

Then we download this address

You can see the speed here

5. Install Browser Extensions

Address: https://github.com/fhefh2015/Fast-GitHub

How to use:

Open the extension page from settings -> more tools -> extensions, or enter chrome://extensions/ into the address bar and press enter to open the extension page

Install extension: Developer mode -> Refresh page -> Drag downloaded .crx file into the extension page

If you encounter a “CRX_HEADER_INVALID” error when adding Google extensions

Google Chrome shows an invalid package error: “CRX_HEADER_INVALID” solution

Enable the [Developer Mode] button on the top right corner of the extension installation page, then refresh the page, and drag the downloaded .crx file into the extension installation page.

6. Use FastGitHub Software (Recommended)

GitHub: https://github.com/dotnetcore/fastgithub/releases

Official website: https://fastgithub.cn/

Installation Deployment Method

2.1 windows-x64 Desktop
  • Double-click to run FastGithub.UI.exe
2.2 windows-x64 Service
  • fastgithub.exe start // Install and start as Windows service
  • fastgithub.exe stop // Uninstall and delete as Windows service
2.3 linux-x64 Terminal
  • sudo ./fastgithub
  • Set system auto-proxy to http://127.0.0.1:38457, or manually proxy http/https to 127.0.0.1:38457
2.4 linux-x64 Service
wget https://github.com/dotnetcore/FastGithub/releases/download/2.1.4/fastgithub_linux-x64.zipunzip fastgithub_linux-x64.zip -d /usr/local/cd /usr/local/fastgithub_linux-x64/./fastgithub startsystemctl status fastgithub.service 
  • sudo ./fastgithub start // Install and start as a systemd service
  • sudo ./fastgithub stop // Uninstall and remove as a systemd service
  • Set system auto-proxy to http://127.0.0.1:38457, or manually proxy http/https to 127.0.0.1:38457
2.5 macOS-x64
  • Double-click to run fastgithub
  • Install cacert/fastgithub.cer and set trust
  • Set system auto-proxy to http://127.0.0.1:38457, or manually proxy http/https to 127.0.0.1:38457
  • Detailed configuration information
2.6 Docker-compose One-click Deployment
  • Prepare docker 18.09, docker-compose.
  • In the source code directory, there is a docker-compose.yaml file, specifically for temporary use of GitHub.com source code in actual projects for demo configuration.
  • Update the sample and build images in docker-compose.yaml according to your needs to complete the GitHub.com source code acceleration and perform subsequent operations based on the source code.
https://github.com/docker/composecurl --insecure -L https://download.fastgit.org/docker/compose/releases/download/v2.6.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-composechmod +x /usr/local/bin/docker-composedocker-compose -vcat > docker-compose.yml <<"EOF"version: "3.7"services:  fastgithub:    image: slcnx/fastgithub    network_mode: host    restart: always    volumes:    - cacert:/fastgithub/cacert/  sample:    depends_on:    - fastgithub    image: slcnx/ubuntu:18.04    volumes:    - cacert:/tmp/cacert    - build_data:/build_data    working_dir: /build_data    restart: on-failure    tty: true    entrypoint: sh -c 'cp /tmp/cacert/fastgithub.cer /usr/local/share/ca-certificates/fastgithub.crt && update-ca-certificates && git clone https://github.com/kubernetes/kubernetes.git'    command: ""    environment:      https_proxy: http://0.0.0.0:38457      http_proxy: http://0.0.0.0:38457    network_mode: host  build:    working_dir: /build_data    depends_on:    - sample    image: nginx    volumes:    - build_data:/build_datavolumes:  cacert: {}  build_data: {}EOF

Problem Solving

Firefox Failed to Establish a Secure Connection

An error occurred while connecting to github.com. The peer’s certificate has an invalid signature. Error code: SEC_ERROR_BAD_SIGNATURE

Solution

1. Enter in the address bar: about:config

2. Enter preference name: security.enterprise_roots.enabled

3. Change the value to: true

Firefox suggests “Connection has a Potential Security Issue”

Settings -> Privacy & Security -> Certificates -> View Certificates -> Certificate Authorities, Import cacert/fastgithub.cer, and check “Trust this CA to identify websites”.

git.exe clone, pull, or push certificate exception

fatal: unable to access ‘https://github.com/xxx.git/’ SSL certificate problem: unable to get local issuer certificate

Solution

Run as administrator: cmd

In cmd input: git config --global http.sslverify false

Cons

1. After activating this proxy, picgo cannot upload images, reporting “RequestError: Error: unable to verify the first certificate”, currently unresolved

2. Currently, it can only accelerate GitHub on the local machine and cannot serve as a proxy for other machines.

7. Use dev-sidecar Software (Recommended)

https://github.com/docmirror/dev-sidecar

https://github.com/docmirror/dev-sidecar/releases/tag/v1.7.3

Windows download and install it.

Ubuntu:

wget https://github.com/docmirror/dev-sidecar/releases/download/v1.7.3/DevSidecar-1.7.3.AppImagechmod +x ./DevSidecar-1.7.3.AppImage ./DevSidecar-1.7.3.AppImage --no-sandbox

Pros

Can be used as a proxy for other machines, usable on Ubuntu or Windows.

Cons

Less stable than fastgithub, thus acceleration effect is not as good as fastgithub.

However, it does not affect picgo image uploads, which is more suitable for me.

Error

Failed to Establish a Secure Connection

An error occurred while connecting to github.com. The peer’s certificate has an invalid signature.

Error code: SEC_ERROR_BAD_SIGNATURE

Solution:

Method 1: Copy the server’s crt file and import the certificate.

Method 2: Uncheck the “Enable Interception” option.

Summary

1. Proxy site: https://ghproxy.com/

2. Install software: fastgithub or dev-sidecar