• Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

Github sometimes suffers from sudden connection failures, sometimes caused by address resolution errors. This article describes how to resolve these problems.

Problem of repetition

Github was fine, but it might have an error at some point.

Connection to XXXXX port 22: Software caused connection abort
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Copy the code

This problem can also cause Hexo to report an error during Hexo d:

Ssh_dispatch_run_fatal: Connection to 13.250.177.223 Port 22: Broken pipe fatal: SHA1 file '< STdout >' Write error: Broken pipeiB/s fatal: the remote end hung up unexpectedly fatal: the remote end hung up unexpectedlyCopy the code

The reason for the error

  • The network impassability
  • The local DNS failed to resolve the address correctly

solution

Whether you can access github or not, github is there because our network could not find the current github address on DNS.

Plan a

The solution is to manually find the GIthub IP address and add it to host, so that we can directly read the IP address from host and access it.

Scheme 2

Using proxy Tools

Solution 1

Find the Github IP address

IP address query website: www.ipaddress.com/

  • Query github.com

  • Save the result

  • Query github.global.ssl.fastly.net

  • Save the result

Write to host file

  • Windows

Open the hosts file in C:\Windows\System32\drivers\etc and add the above result:

# github
140.82.112.4 github.com
199.232.69.194 github.global.ssl.fastly.net
Copy the code

or

# github
192.30.253.112 github.com 
151.101.185.194 github.global.ssl.fastly.net
Copy the code

or

Git # making 192.30.255.112 github.com 185.31.16.184 github.global.ssl.fastly.netCopy the code
  • Linux

Open the \ etc \ hosts

# github 
140.82.112.4 github.com
199.232.69.194 github.global.ssl.fastly.net
Copy the code

or

# github
192.30.253.112 github.com 
151.101.185.194 github.global.ssl.fastly.net
Copy the code

or

Git # making 192.30.255.112 github.com 185.31.16.184 github.global.ssl.fastly.netCopy the code

The refresh DNS

  • Windows

Open a command prompt and enter the following command:

ipconfig /flushdns
Copy the code
  • Linux

Enter:

sudo rcnscd restart
Copy the code

Restart your browser to access Github

Solution 2

  • Installing network ToolsDeveloper sidecarTo speed up making
  • Gitee: gitee.com/docmirror/d…
  • Download the latest release
  • Install the software

  • While driving, GitHub failed to connect and the problem was solved