Git SSH over port 443
Certain networks may block traffic on port 22, which causes failure for Git operations like:
ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository.
The solution for this is to at least temporarily configure SSH to use port 443, which is typically open for HTTPS traffic. This can be persistently done by editing the user SSH config file usually located at “~/.ssh/config”, here for GitHub:
Host github.com
User git
IdentityFile ~/.ssh/github
Hostname ssh.github.com
Port 443where “~/.ssh/github” comes from GitHub SSH key setup.
Likewise for GitLab:
Host gitlab.com
User git
IdentityFile ~/.ssh/gitlab
Hostname altssh.gitlab.com
Port 443An alternative is to specify the port directly in the Git remote URL like:
git push ssh://user@host:PORT/path/to/repo.git mainOr specify environment variable GIT_SSH_COMMAND.