Gt Report Error ssh:connect to host github.com port 22

kex_exchange_identification: Connection closed by remote host
Connection closed by 140.82.121.3 port 22
fatal: Could not read from remote repository.

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

  It is suddenly found that git cannot operate, and an error is reported, as shown in the figure above.

Thought the SSH key failed?Check it. It’s corresponding.

Testing

$   ssh -T   [email protected]

The result is still  

Internet search method:

Test port 443 can be successful  

$ ssh -T -p 443 [email protected]

Referring to the online method, the solution is as follows:

  Locate git’s config file  /etc/ssh/ssh_ Config and edit

$   vi /etc/ssh/ssh_ config     

If you don’t have permission, use sudo

Add the following code at the end and save

Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

success!  

Then you can operate git normally!

Read More: