Phillip
Phillip

Reputation: 73

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

So I've been getting this error when attempting to clone a repo from my company's network, and I'm assuming there's a firewall blocking the port.

user@host:~/test_dir$ git clone [email protected]:master/migration.git
Cloning into 'migration'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

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

I tested the solution from this post https://stackoverflow.com/a/54191729/4175957 which was to add the following lines to the ~/.ssh/config file:

Host github.com
  Hostname ssh.github.com
  Port 443

It didn't work. Every answer I try to find says to do the same thing, I haven't found any other workaround.

Any ideas?

Upvotes: 3

Views: 11782

Answers (2)

Jin Majue
Jin Majue

Reputation: 1

Maybe you can try connecting to a different network (e.g., a mobile hotspot) and test again. I just do it you have said: add the following lines to the ~/.ssh/config file:

Host github.com
  Hostname ssh.github.com
  Port 443

it also doesn't work, then i change network-- my mobile hotspot. so it works. you can try it.

Upvotes: 0

VonC
VonC

Reputation: 1323953

I confirm a company network is by default blocking any egress SSH query (to avoid encrypted flux)

I can only use HTTPS URL with github.com in a company environment.
That would therefore be the official workaround.

Upvotes: 3

Related Questions