ssh: connect to host github.com port 22: Connection refused

Solution 1:

Have you tried using port 443, and adding ssh. subdomain prefix?

This command will test it. You should get an error since a shell is not supported.

ssh -T -p 443 [email protected]

Then you can use a full URL to specify the project path, see Stack Overflow answer for details:

ssh://[email protected]:443/yourname/reponame.git

Solution 2:

If you get a connection refused, it means you actually got a packet back which states that your destination does not accept your connection. This could mean a few things:

  1. github.com is down (not too likely, but you could always check their status on https://status.github.com/)

  2. you have an invalid IP address for github.com (manual entry in /etc/hosts or your resolver) which blocks ssh from at least your IP address

  3. you have a firewall along the way to github.com which blocks the ssh traffic (eg. local firewall or corporate firewall)