Hexa's Blog

How to fix ssh: connect to host github.com port 22: Connection timed out

09/06/2025 @ Saigon Linux

At first, let make it clear! on May 25th, vietnamese goverment started blocking telegram.

As a consequence, I have to use CloudFlare WARP to dogde it. It’s fine till I have trouble pushing/cloning my source code to github. I am pretty sure that CloudFlare did something as a middle man!

$ ssh -T git@github.com
# ssh: connect to host github.com port 22: Connection timed out

So, there are two choices:

  • [1] Turn off cloudflare’s warp client
  • [2] Change github ssh port from 22 to 443

This post is all about the second solution. Do ssh to ssh.github.com port 443 instead of github.com port 22.

If you run ssh -T -p 443 git@ssh.github.com and it works, you can continue reading this post. Else, this post is not for you cause ssh.github.com port 443 is also BLOCKED.

$ ssh -T -p 443 git@ssh.github.com
# Hi nguyenvinhlinh! You've successfully authenticated, but GitHub does not provide shell access.

If you see that message Hi nguyenvinhlinh! You've successfully authenticated, but GitHub does not provide shell access. You can alias ssh’s config and work around ssh's port 22, connection timeout error.

I will make it short! Edit file ~/.ssh/config with the following config.

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

And test it with: ssh -T git@github.com. You should see output like:

Hi nguyenvinhlinh! You've successfully authenticated, but GitHub does not provide shell access.

Good luck!

References