5

The way I configuration the SSH key, I generate a new SSH key, and add it to my GitHub account, but something is wrong. I tried many ways, but I could not fix it.

ssh -vT [email protected]

Output:

OpenSSH_8.1p1, OpenSSL 1.1.1d  10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [111.40.234.2] port 22.
debug1: Connection established.
debug1: identity file /c/Users/dell/.ssh/id_rsa type 0
debug1: identity file /c/Users/dell/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/dell/.ssh/id_dsa type -1
debug1: identity file /c/Users/dell/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/dell/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/dell/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/dell/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/dell/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/dell/.ssh/id_xmss type -1
debug1: identity file /c/Users/dell/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
kex_exchange_identification: Connection closed by remote host

What can I do?

1
  • 1
    You seem to be using Windows and Cygwin. These details should probably be mentioned in your question. Also, how is your ssh client configured, and how specifically are you tel\ing it which key to use for Github?
    – tripleee
    Jan 11, 2020 at 14:47

3 Answers 3

4

I guess you are using a VPN connection in your network and the VPN may have disabled port 22, so you need to cancel the VPN use or change the GitHub connection to port 443.

Edit ~/.ssh/config file, and save it.

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

Again test (as root):

ssh -T [email protected]

Output:

The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts.
Hi xxxxxx You've successfully authenticated, but GitHub does not provide shell access.
1

I suspect there're too many keys in your ~/.ssh/. Point ssh to the exact key you use. In ~/.ssh/config:

Host github.com
    User git
    HostName github.com
    IdentityFile ~/.ssh/id_rsa # or whatever key you use with Github

Then try ssh -Tv [email protected] again.

1
  • 1
    I have only one key,and I try this way,but it still can not.
    – aptx1231
    Jan 12, 2020 at 9:19
1

If you have only one key, try and regenerate it with the old PEM format, and no passphrase, for testing:

ssh-keygen -t rsa -P "" -m PEM

Copy the content of id_rsa.pub to your GitHub profile, and try again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.