Git SSH Port 22 Blocked (GSP22B)

SSH on port 22 is the standard protocol used for securely accessing servers, including managing Git repositories on remote servers. However, when port 22 is blocked, SSH access cannot be performed directly. This can happen for several reasons, such as network policies at workplaces, internet service providers restricting access to certain ports, or security measures. This blockage complicates tasks for users who rely on Git over SSH, making it difficult to clone, pull, and push repositories to remote servers.

To resolve this issue, a common solution is to change the SSH port to one that is not blocked or to use alternative connection methods like HTTPS. Some servers also support alternative ports, such as port 443, which is rarely blocked as it’s generally used for HTTPS traffic. By using these solutions, users can still access Git on remote servers even when port 22 is blocked. This understanding is essential for developers who frequently use Git, especially in environments with strict network security restrictions.


When you are working on more than one git account, something like this will usually appear:

git push -u origin master
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.

Solution

Change the port to 443 in the config file.
~/.ssh/config
 
Host github.com
  Hostname ssh.github.com
  Port 443

Save and happy working!

Post a Comment

Previous Next

نموذج الاتصال