Solutions to github cannot be opened or slow to load
Foreword
GitHub is a hosting platform for open source and private software projects, because it only supports Git as the only repository format for hosting, hence the name GitHub.
As an open source code library and version control system, Github has more than 9 million developer users. As more and more applications move to the cloud, Github has become the preferred method for managing software development and discovering existing code.
Recently I wanted to tinker with it, but I found a problem and I can’t access the GitHub website at all (Is my thoughts about to be pinched out as soon as they sprout?), that’s right, the picture below
This was so anxious for me, so I immediately asked Baidu for help. I also assembled many tutorials (trying the methods of various great gods), and finally solved the problem. (Pay attention to check if you are surfing the Internet scientifically, this will also lead to inaccessibility)
Here is a solution (useful for pro-testing)
One: Modify the hosts file
windows
- Find the hosts file
The path is: C:\Windows\System32\drivers\etc\hosts - Edit the file
You can open it with Notepad and copy the text below.
192.30.253.112 github.com |
- Save (try again if you can open GitHub)
Linux
- Also find the hosts file
But the path becomes: /etc/hosts - Edit the hosts file
Also copy the following code block (same as above) and save
192.30.253.112 github.com |
- Generally, the permissions are not enough for modification, and you need to obtain root permissions. Of course, temporary root permissions are also OK.
Enter vim /etc/hosts to modify
Use the above content to solve the problem, check the relevant IP by yourself
The following demonstrates the IP query methods of several nodes, and the others find themselves
First determine the IP of GitHub
turn on
You can see that the IP address is: 140.82.114.4 (according to personal circumstances)
Determine the IP of the domain name:
turn on
Link
IP is 192.232.69.194
Determine the IP of the static resource:
turn on
Link
According to the above method 1 or method 2, query the contents of the hosts one by one, and write the hosts file
Add as follows (written according to personal circumstances, the following is mine)
140.82.114.4 github.com |
Two: Modify DNS resolution
- Right-click on the network icon
- Click to open the “Network and Internet” settings
- Pull down to find the Network and Sharing Center, click to enter
- Click the red box to select the part
- Click Properties
- Select Internet Protocol version 4, click Properties
- Choose to use the DNS server address below and enter the DNS address
- Here I recommend two 4.2.2.2 (Microsoft) and 223.5.5.5 (Ali), then click OK
Three: Refresh the DNS resolution cache
After changing the hosts file, it is recommended to refresh the DNS cache
1.win+R open the run window, enter cmd, click OK to open the cmd window
- Enter the following command and press Enter
ipconfig /flushdns |
Four: github mirror access
Two github mirror sites are provided here, in case of unexpected events
Five: New
Add one
- Open the DNS query tool (this is a tool for querying the mapping of domain names)
- Enter github.com and click detect
You can also check the following URL (I checked the github official website), and then follow the steps below
github.global.ssl.fastly.net |
- Find the smallest TTL value in the query result and copy its ip
- Write the hosts file, save it, and how to write it has been mentioned before, so I won’t repeat it
Add two
It’s very tiring to query the ip by yourself, I also found a lot of automatic query projects on github, friends can go and see
If you don’t understand the specific eating method, you can ask me (personally recommend the first one)
Remarks
This article only records how I solved the problem of inaccessibility to GitHub
It is recommended to find the IP by yourself, failure is normal