Home > Software design >  Solving the a client side SSH connection error
Solving the a client side SSH connection error

Time:11-14

Essentially I cannot connect to an SSH server anymore. Whenever I try to connect I get the following error:

ssh: connect to host HOSTNAME port 22: Connection refused

Note that I am able to connect from a different machine. Hence, the issue seems to be client side. Furthermore, I also cannot pull/push to git repositories that are cloned via ssh. Again, when pulling I get the following error:

ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.

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

It seems like I somehow nuked my SSH installations/config files. I have reinstalled SSH but this did not fix the problem. Any ideas?

CodePudding user response:

Note that you never "connect" to github.com directly (no interactive shell)

As mentioned here, "Connection refused" means

  • invalid IP address for github.com (manual entry in /etc/hosts or your resolver)
  • firewall along the way to github.com which blocks the ssh traffic (eg. local firewall or corporate firewall)

So is the other machine (where you do succeed) on the same network?
Check if the other machine SSH config file was not using ssh.gthub.com port 443 (instead of the default github.com:22, typically blocked in a corporate environment).

  • Related