The error below often occurs when a change happens in your local network, ISP etc. The solution is as simple as below. For more information, read Using SSH over the HTTPS port.


Error


$ git pull origin hotfix/1.66.1
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.
Fatal: Could not fetch hotfix/1.66.1 from origin.

Solution


Authentication


If you get a question, answer "yes".


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

Override SSH settings


$ sudo nano ~/.ssh/config

# Add section below to it
Host github.com
Hostname ssh.github.com
Port 443

Verify


If you tried this at the beginning, it would hang and timeout.


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