This happened to me when doing a git pull from a coffee shop.
ssh: connect to host github.com port 22: Operation timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
The reason is because port 22 is blocked at the coffee shop wifi router. Turns out github allows https to do git operations.
git config --local -e
Change (or comment it out using #)
url = email@example.com:username/repo.git
url = https://github.com/username/repo.git
Then the git operations once stuck would work.
One thought on “ssh: connect to host github.com port 22: Operation timed out”
Probably easier to just change the DNS on your local machine to 18.104.22.168 or 22.214.171.124 for example.
LikeLiked by 1 person