GitHub, as we all know, is the world’s largest hosting platform for open source and software projects. There are a large number of excellent open source software published on this platform every day from all over the world.
Because of China’s heavy censoring system, access to Github from inside the country often slowed down or, in many occasions, completely taken down.
If you want to speed up the download speed from GitHub in China, you need to use a domestic acceleration service. For those who are able to afford it, you can use a proxy or VPN to speed up the access speed. Otherwise, you can use the following services to achieve acceleration:
You can access Github using web proxies. The proxies will send requests to Github then forward the response to your browser.
Here are the two most commonly used mirror addresses:
In other words, the above mirror is a clone of GitHub.
The content of the website is a fully synchronized mirror of GitHub, forwarded to you in realtime.
Sometimes, especially in working hours, these web proxies send so many requests that Github blocks them for a while. In those cases, you’ll need to find another way to access Github.
GitHub personal proxy using Cloudflare Workers
Cloudflare is the only international CDN that isn’t blocked in China.
Here’s two demos of what a Github personal proxy would look like.
If you can’t open the demos, you can still clone hunshcn/gh-proxy and use the code to roll your own site.
Please note that this project does not allow you to browse Github . gh-proxy only supports git cloning through the proxy and downloading zipped version of repositories.
Github accelerated download (GitHub 加速下载)
Another web proxies you can instantly use is GitHub 加速下载 which literally means "Github accelerated download" .
To use it, just copy the repository address and paste it into the input box at toolwa.com/github/ to browse and download from Github!
Google Chrome GitHub acceleration plugin (recommended-convenient and fast)
If you can directly access the Google store, you can go to the chrome web store to download an extension called "GitHub 加速工具" (GitHub acceleration plugin) to help with the downloading.
In case you’re unable to reach chrome web store too, the extension can be downloaded here:
GitHub raw address
If you want only one or two files from a repository, you can access it by using raw.githubusercontent.com instead of the web interface at https://github.com.
Sometimes, even the raw domain can be blocked. In this case, there a twist to this method. Replace raw.githubusercontent.com with raw.staticdn.net and the file is accessible again.
Using Gitee to fork from Github
Gitee, a Chinese Github alternative, offers server-side forking/cloning from Github.
Simply visit the gitee website at gitee.com/ and log in, then select "Import repository from GitHub/GitLab" at the top as follows:
Now paste your Github repository URL address into the import page and click Import:
Wait for the import operation to complete, then download and browse the corresponding GitHub repository code inside the repo you’ve just created
You can also click the "Refresh" button at the top of the repository to synchronize the Github code repository.
9. Hardcode Github’s IP in HOSTS file
- Obtain the global.ssl.fastly.net address of github.
Go to : github.global.ssl.fastly.net.ipaddress.com/#ipinfo .
Next, obtain the subdomain name and the IP address of the Fastly server that serves Github content.
E.g : 220.127.116.11 for github.global.ssl.fastly.net
- Repeat the steps above, but for github.com itself.
Visit: github.com.ipaddress.com/#ipinfo to get domain name and the corresponding IP address.
E.g : 18.104.22.168 github.com
- Modify the host file to map Github domain names to the IPs we’ve found
On Windows systems, you need to edit C:WindowsSystem32driversetchosts file.
On Linux systems, you need to edit (with root access) the file located in /etc/hosts.
Simply include these lines in your hosts file and then you can access Github again.
Manually circumventing China’s Firewall to access Github is a hit-and-miss task. If none of the solutions above works in your situation, consider using a VPN.
Remember to avoid free VPNs all over the internet because they can mix your traffic with bad people. If you don’t mind fiddling with configurations, we would recommend setting up a personal, private V2Ray or NaiveProxy server of your own.
1 thought on “How to access GitHub from inside China”
Thanks, it is very useful for a normal IT worker in china…