3

I changed the WiFi in the place I lived and found that the GitHub website can’t be posted when using a Mac, but the phone can log in normally. At the same time, when I use push to push the code, it prompts Failed to connect to github.com port 443: Operation timed out . The push is difficult to succeed, so I found a solution on the Internet and recorded it. Come down so that others can easily solve this problem.

1. Visit the following website to obtain an IP address

Visit the following URLs respectively, and obtain the IP addresses below. These IP addresses and corresponding URLs will be used to fill in the host file later.

URLCorresponding URL
https://github.com.ipaddress.comgithub.com
https://websites.ipaddress.com/github.global.ssl.fastly.net#ipinfogithub.global.ssl.fastly.net
https://github.com.ipaddress.com/assets-cdn.github.comassets-cdn.github.com

Website screenshot:
IPAddress

2. Fill in the obtained IP address into the host file

The host file cannot be modified directly, but it can be copied to other places and pasted after modification. If you are afraid of making mistakes, you can back up another host file to paste and restore. /etc/hosts in the Go to Folder function of the Finder.
After opening the host file, write the content into the host file line by line in the format of the URL corresponding to the IP address of , and overwrite it back to its original folder. Overwriting requires permission.
The format is as follows:

host其他内容

52.74.223.119 github.com
233.233.233.233 github.global.ssl.fastly.net

3. Refresh DNS

Enter the following command in the terminal to refresh the DNS. This command requires permission. You need to enter a password in the terminal. The password is not visible. After the input is complete, press Enter.

sudo killall -HUP mDNSResponder;say DNS cache has been flushed

4. Go online

Now you can access GitHub normally again, and there will be no connection failure when operating the warehouse.


Lynx
206 声望3 粉丝

步步