Github SSH over HTTPS (traveling)
The goal of this method is to not requiring you to change every git repositories URL
from the normal ssh pattern git clone git@github.com:user/repo.git
and be able to git clone/fetch/pull/push as normal with your ssh key.
Firewalls sometimes block SSH connections
Sometimes, firewalls refuse to allow SSH connections entirely.
If a proxy blocks port 443, you are out of luck.
If you are on GitHub Enterprise (as of 2025-05-10), you are also out of luck.
To test if SSH over the HTTPS port is possible, run this SSH command:
ssh -T -p 443 git@ssh.github.com
Which, if successful, should print something like this:
# Hi USERNAME! You've successfully authenticated, but GitHub does not
# provide shell access.
Enabling SSH connections over HTTPS
If you are able to SSH into git@ssh.github.com over port 443, you can override your SSH settings to force any connection to GitHub.com to run through that server and port.
This has the advantage of not requiring you to change every git repositories URL from the normal ssh pattern
git clone git@github.com:user/repo.git
To set this in your SSH configuration file, edit the file at ~/.ssh/config
, and add this section:
Host github.com
Hostname ssh.github.com
Port 443
User git
You can test that this works by connecting once more to GitHub.com.
ssh -T git@github.com
this is the normal command, with your ssh config taking precendence for this hostname.
Updating known hosts
The first time you interact with GitHub after switching to port 443, you may get a warning message that the host wasn't found in known_hosts, or that it was found by another name.
# The authenticity of host '[ssh.github.com]:443 ([140.82.112.36]:443)' can't be established.
# ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
# This host key is known by the following other names/addresses:
# ~/.ssh/known_hosts:32: github.com
# Are you sure you want to continue connecting (yes/no/[fingerprint])?
It is safe to answer "yes" to this question, assuming that the SSH fingerprint matches one of GitHub's published fingerprints. For the list of fingerprints, see GitHub's SSH key fingerprints.