Ssh: connect to host port 22: Network is unreachable


Hello and good morning from a chilly and damp autumnal north London.

This is my first post on the Odin forums. I have spent a few hours on the project so far and just finished installing ruby on xubuntu within a virtualbox vm in windows 10, and am about to work through onto the ruby on rails project today.

Stepping back slightly, when I got to section 2.5 in Setting Up Git and try and test the connection in xubuntu terminal, I get the following error:

$ ssh -T
ssh: connect to host port 22: Network is unreachable

I can work around this by using http port 443 (which I googled to find out) to get the expected response:

$ ssh -T -p 443
Hi jimfood! You’ve successfully authenticated, but GitHub does not provide shell access.

Following a bit more investigation, I have a few of questions:

  1. Is using http port 443 a suitable workaround at this stage in the project?
    I believe traffic can be directed to 443 for github by changing a configuration file in xubuntu.

  2. Or, should I spend more time trying to open port 22 at this stage, to avoid future issues in the project?
    I have already spent a couple of hours searching and trying to eliminate the problem (opening the port on my router, opening the port on windows firewall, allowing virtualbox connections in windows firewall, trying a bridged adapter in virtualbox settings) which hasn’t worked yet. I have also tried ‘ssh -T’ on my windows10 host but this times out, so I’m guessing the overall issue is a firewall problem somewhere between my windows and github rather than a virtualbox/xubuntu issue.

  3. Or, should I do something else to solve the port 22 problem.

Thanks for reading. Any help appreciated.



Hello again. A brief follow up…

I’m now just into the ruby on rails project and when running the following in terminal when trying to connect to my github repository, I get:

$ git push -u origin master
jimfood@jimfood-VirtualBox:~/odin_on_rails/my_first_rails_app$ git push -u origin master
ssh: connect to host port 22: Network is unreachable
fatal: Could not read from remote repository.

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

By the way, I definitely can get through my firewall on port 22 from my windows host, as I can ssh with port 22 into my aws mailserver using putty.

Seems like I’m stuck with the port 22 problem at the moment.

Thanks again for any help!