Solve the SSH connection GitHub appears Connection Closed

Original link: https://paugram.com/tech/github-ssh-connection-closed-problem-with-proxy.html

GitHub has banned the use of HTTPS to submit code in the early days, so I switched to SSH to connect to the warehouse. Recently, when the company used a third-party proxy service, it was found that multiple nodes could not be used normally. At first, I suspected that it was a problem with the SSH key configuration, but GitHub showed that I had not used the new key to connect…

The specific error information is as follows:

 kex_exchange_identification: Connection closed by remote host Connection closed by 198.18.0.15 port 22 fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

The company also has a self-built proxy service, which was used to submit code to GitHub before, and it has always been normal. However, due to the recent instability of the company’s mobile network, the connection has been timed out and unavailable (China Unicom is normal), so I have to think about other methods.

Tried the nodes provided by other proxy service providers, but it is still not available. I suspected that it was a restriction imposed by the service provider, so I asked the company to ask the customer service for the corresponding account owner. The result is that the service provider disabled port 22 (connecting to the SSH service defaults to port 22), and it can be replaced with 443 .

After simply reading this article, since I have configured multiple SSH keys in multiple sites, I directly selected it to modify config operation, and successfully solved the above problems.

 # GitHub Host github.com Port 443 User git HostName ssh.github.com PreferredAuthentications publickey IdentityFile ~/.ssh/git_ed25519

This article is transferred from: https://paugram.com/tech/github-ssh-connection-closed-problem-with-proxy.html
This site is only for collection, and the copyright belongs to the original author.