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 git@github.com

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
aptx1231
  • 59
  • 1
  • 1
  • 3
  • 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 '20 at 14:47

3 Answers3

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 git@github.com

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.
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jason
  • 88
  • 6
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 git@github.com again.

phd
  • 82,685
  • 13
  • 120
  • 165
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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250