Home > Software engineering >  SSH connection to Github via port 443
SSH connection to Github via port 443

Time:08-06

I have my github keys working on port 22, a simple test like

ssh -T [email protected] 

Returns,

"You've successfully authenticated, but GitHub does not provide shell access"

However, when I try the same with port 443, which I believe it should work,

ssh -vvvT [email protected] -p 443

I get,

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data ~/.ssh/config
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolving "github.com" port 443
debug2: ssh_connect_direct
debug1: Connecting to github.com [140.82.112.3] port 443.
debug1: Connection established.
debug1: identity file ~/.ssh/id_rsa type 0
debug3: Failed to open ~/.ssh/id_rsa-cert error:2
debug3: Failed to open ~/.ssh/id_rsa-cert.pub error:2
debug1: identity file ~/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
kex_exchange_identification: Connection closed by remote host

I have tried many forums and online searches, but it hasn't resolved. Am I missing something? Thanks.

In past I have successfully used ssh over 443 for github pulls/pushes. Github has documention on how to use 443 for ssh here: https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port

CodePudding user response:

The documentation that you linked to indicates that you can connect to a hostname of "ssh.github.com" on port 443:

$ ssh -T -p 443 [email protected]
                    ^^^^^^^^^^^^^^-- Note "ssh.github.com"

According to your debug output, you're connecting to "github.com", not "ssh.github.com":

ssh -T [email protected]
...
debug1: Connecting to github.com [140.82.112.3] port 443.
                      ^^^^^^^^^^-- Note no "ssh"

The second part of the page describes how you can configure your ssh client so that when you tell it to connect to "github.com", it will connect to "ssh.github.com" instead. As it describes, you could add the following four lines to the end of your local .ssh/config file:

Host github.com
Hostname ssh.github.com
Port 443
User git

Once you've done that, running a command like ssh -T [email protected] would actually connect to the hostname "ssh.github.com"

  • Related