SSH Authentication

I am new to GitHub and to some extent SSH Keys. I have created my GitHub Account and added my SSH public key to it. I can log into my Ubuntu 20.04 server using my SSH key. I get an error with the command below

git clone git@github.com:loriandsmith/ansible.git
Cloning into 'ansible'...
Received disconnect from 140.82.112.3 port 22:2: Connection blocked because server only allows public key authentication. Please contact your network administrator.
Disconnected from 140.82.112.3 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I’ve spent probably 3+ hours trying to figure this out before asking for help. Below is the output of my verbose ssh connection

user@ansible:~$ ssh -vT git@github.com
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to github.com [140.82.113.4] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type -1
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/user/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/user/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/user/.ssh/id_ed25519 type 3
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: identity file /home/user/.ssh/id_ed25519_sk type -1
debug1: identity file /home/user/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/user/.ssh/id_xmss type -1
debug1: identity file /home/user/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: Remote protocol version 2.0, remote software version babeld-c34a939f
debug1: no match: babeld-c34a939f
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:+5rIJPDvjWoKlkpYVuym+5RIt9G4FXMDY2nXkuHCALM
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/user/.ssh/id_rsa 
debug1: Will attempt key: /home/user/.ssh/id_dsa 
debug1: Will attempt key: /home/user/.ssh/id_ecdsa 
debug1: Will attempt key: /home/user/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/user/.ssh/id_ed25519 ED25519 SHA256:2eqt611eXdbhTPsnQYjgNuhEcx8Oi2vVw4abWxP+tDU
debug1: Will attempt key: /home/user/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/user/.ssh/id_xmss 
debug1: SSH2_MSG_SERVICE_ACCEPT received
Received disconnect from 140.82.113.4 port 22:2: Connection blocked because server only allows public key authentication. Please contact your network administrator.
Disconnected from 140.82.113.4 port 22

The SHA256 Key below matches what I see in my GitHub SSH settings.

SHA256:2eqt611eXdbhTPsnQYjgNuhEcx8Oi2vVw4abWxP+tDU

I’ve read through the document
https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

Any ideas?

@loriandsmith if you are going through a corporate proxy or other proxy doing interception of your SSH traffic that is commonly blocked or cause of problems.

1 Like