ssh: troubleshooting port 22 connection refused

2021-10-01

 | 

~1 min read

 | 

175 words

ComEd told me yesterday that they’d be turning off my power today. So, I had to go find a new place to work today and I ended up at the hospital where I found a little corner to work in.

When I was ready to actually push my code up, however, I ran into trouble:

% ssh -T git@github.com
ssh: connect to host github.com port 22: Connection refused

I’d configured my SSH in a standard way (in my opinion):

% cat ~/.ssh/config
Host github.com
  HostName github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_github_rsa

In this particular case, it looks like the hospital’s Network administrators blocked port 22. So, I worked around this by adding a port to my config:

$HOME/.ssh/config
Host github.com
  HostName github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_github_rsa
+  Port 443

Talking with my security team, however, this was encouraged to be temporary as it’s not always supported. For example:

GitHub Enterprise Server users: Accessing GitHub Enterprise Server via SSH over the HTTPS port is currently not supported.


Related Posts
  • 2021 Daily Journal


  • Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!