1

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?

phd
  • 82,685
  • 13
  • 120
  • 165
julian
  • 73
  • 7
  • 1
    When you run `ssh git@github.com`, does it return your github username? – Martheen Nov 14 '22 at 07:40
  • I get the same error: ssh: connect to host github.com port 22: Connection refused – julian Nov 14 '22 at 08:07
  • If you're in a corp env, complain to your IT. Otherwise, try using Cloudflare WARP. – Martheen Nov 14 '22 at 08:09
  • I am on eduroam. By adding the github host to the ssh config file I am able to pull from github now. But I am still unable to connect via SSH to my private server, even when using the -p 443 argument. – julian Nov 14 '22 at 08:17
  • 1
    Use Cloudflare WARP, if it's blocked too then setup your own OutlineVPN instance on a VPS. – Martheen Nov 14 '22 at 08:40

1 Answers1

0

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).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I am on eduroam. By adding the github host to the ssh config file I am able to pull from github now. But I am still unable to connect via SSH to my private server, even when using the -p 443 argument. – julian Nov 14 '22 at 08:21
  • @julian So firewall issue then? – VonC Nov 14 '22 at 08:21
  • But this problem persists when I use my personal phone hotspot as well. None of these things were the case 2 days ago. – julian Nov 14 '22 at 08:24
  • @julian "connect via SSH to my private server" the same answer would apply: some kind of IP or firewall issue. – VonC Nov 14 '22 at 08:32