preface
GitHub is probably the most visited site for developers. There are a lot of great projects on GitHub, and it’s a great place for developers to find resources, make friends and learn. In particular, GitHub recently announced the Arctic Code Vault, a project to bury Code 250 meters underground in permafrost, where it can be preserved for a thousand years. In addition, GitHub has created commemorative badges for developers in their profiles.
Isn’t it a little proud to think that your code could be preserved for a thousand years as one of humanity’s technological treasures?
All right, back to the point.
Although GitHub has not been Q, the speed of accessing GitHub in China is really slow because the CDN servers are all in foreign countries. Sometimes the page cannot be displayed, which has increased the heavy obstacles on my way to obtain knowledge.
So, I spent three hours writing a widget to speed up GitHub access without using t-sub, which I will share with you at the end.
In the meantime, this article will share other ways to speed up GitHub access. It is a more complete arrangement.
Let’s get it!
Automatically generates the fastest access to host widgets
There are many reasons for GitHub’s slow access in China, but the main reason is that GitHub’s distribution accelerated network domain name is contaminated by DNS. In order to solve this problem, there are many articles online that provide a solution, which is to bypass the domestic DNS resolution by modifying the Hosts file and directly accessing the GitHub CDN node, so as to achieve the purpose of speeding up.
However, most of the introductions about this method only provide three github domain names, and you need to check them one by one at ipaddress.com. According to the IP found, ping them by yourself, select the fastest IP, edit them into IP+ domain name format, and post them in the hosts file.
In fact, GitHub uses a lot of related domain names, I sorted out, there are more than a dozen
github.global.ssl.fastly.net
github.com
assets-cdn.github.com
documentcloud.github.com
gist.github.com
help.github.com
nodeload.github.com
codeload.github.com
raw.github.com
status.github.com
training.github.com
avatars0.githubusercontent.com
avatars1.githubusercontent.com
avatars2.githubusercontent.com
avatars3.githubusercontent.com
Copy the code
It is also very troublesome to check and select one by one.
To this end, I wrote a tool that can automatically find the fastest CDN nodes corresponding to these ten domain names according to your current IP address. If one IP corresponds to multiple CDN nodes, the tool will automatically ping for you 10 times and get the IP address of the CDN with the lowest average value.
All you need to do is post the resulting results to your hosts file.
This small tool, follow the “yuan people tribe” type github can be obtained.
The usage is simple, just need to execute the following command to run
java -jar githubhost.jar
Copy the code
When it runs, the browser enters127.0.0.1:8880
Can automatically perform analysis based on your current Ip:
The analysis takes about ten seconds, and the progress bar will refresh automatically. When the progress bar is full, you can see the generated content:
Each region and carrier may run different, so after you get the result, you can add the content to your hosts file (if you don’t know where hosts is stored, you can baidu), and then follow the instructions to make the hosts file effective.
If you specify a CDN access address, your Github access will at least be free of delays.
Code cloud GitHub mirror site
Code Cloud offers a “code cloud Rapid download” site that syncs items from Github every day.
gitee.com/mirrors
Personally, I don’t think all github projects will be synchronized. Looking at the number of warehouses, there are about 15K projects
If you want to clone some projects to research, check here first. Because the code cloud is a domestic open source project site, git Clone speed naturally need not worry, but it is a pity
1. This mirror site isn’t for all Github projects, but most popular ones do
2. There are no issue and Release packages either, just code
3. There’s a one-day delay. What you see is the status of the project from a day ago
4. Because it’s not Github, you can’t push projects to Github through this
Making the mirror stand
The mirror station is:
github.com.cnpmjs.org/
Once in, there is no difference between Github and Github, and access is quick.
The Clone code, in particular, is fast…
For example, if you wanted to clone, write it like this
git clone https://github.com/kubernetes/kubernetes.git
Copy the code
Now change to:
git clone https://github.com.cnpmjs.org/kubernetes/kubernetes.git
Copy the code
Try it on:
At this speed, there should be no desire…
But this method unfortunately:
1. This mirror station is very unstable and you will see it from time to time:
2. You need to modify the URL by yourself every time you clone, which is a little inconvenient
3. You still can’t push
GitClone site
In my search for a solution, I found another site: GitClone
gitclone.com/
This is a GitHub cache accelerator that also caches about 15K items, but GitClone has created a separate site where it can search for items and even create repositories.
Gitclone offers a variety of ways to clone
However, when you search for a project, you will be redirected to the corresponding page on GitHub.
So it’s pretty much the same as gitee mirrors. Change the same, the problem is similar to the previous several mirror sites, but you just want to clone, or a good choice.
conclusion
In fact, without T sub, there are only two ways:
- Modify hosts to directly access the fastest CDN node. This method has the advantage of original taste.
- Access and Clone through mirroring. The advantage of this method is the speed of Clone.
Personal recommendation if the main browsing, or use the tool recommended above to generate hosts for configuration, after all, the original, clone large project, can consider the above mirror site to speed up the download.
Finally, you can share this open source tool with everyone by following the “Yuan People tribe” public account and replying to Github to obtain the jar package of this tool.
After startup, access port 127.0.0.1:8880 to automatically generate.
A adhere to do original technology technology sharing number, I hope you can pay attention to me, I will give a practical original technical article every week, walk with you, no longer afraid.