Earlier today, I wanted to clone a private git repo of mine from Github and, at first, it would not work, giving me errors about ports & rejected identity. In the end, it worked out (pretty much all of a sudden, cannot say what made it work suddently) but then stopped working (of course, without any perceived changes on my side) and now I cannot get it back running.
Error I get:
$ git clone -v git@github.com:/.git
Cloning into ''...
kex_exchange_identification: Connection closed by remote host
Connection closed by 140.82.121.4 port 443
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Things I checked:
Pub key is added on github.com/settings/keys in the "SSH keys" section. Verified it and also tried adding "another" key with the same signature resulting in an error stating that this key had already been added. So I'm reasonably sure I've correctly added the SSH key on Github.
Ensure file permissions for key are correct:
$ ls -al ~ | grep ssh
drwx------ 5 4096 Sep 5 18:04 .ssh
$ ls -la ~/.ssh/id_rsa
-rw------- 1 3434 Mär 31 2022 /home//.ssh/id_rsa
Ensure SSH agent is aware of the key and has it loaded:
$ ssh-add -l
4096 SHA256: (RSA)
Surprisingly, before I checked, the key was not loaded and I had to load it manually, even though the key name is exactly the default name and, therefor, should have been loaded automatically - as far as I know.
For reference, here's the config I'm testing with:
Host ssh.github.com
Hostname ssh.github.com
PubKeyAuthentication yes
Port 443
IdentityFile ~/.ssh/id_rsa
User git
Host github.com
Hostname github.com
PubKeyAuthentication yes
Port 443
IdentityFile ~/.ssh/id_rsa
User git
As you can see, I've also tried with setting values directly in the config as well as running without any ~/.ssh/config at all.
Check SSH connectivity:
$ ssh -vvv -T -p 443 git@github.com
OpenSSH_8.9p1 Ubuntu-3ubuntu0.10, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home//.ssh/config
debug1: /home//.ssh/config line 9: Applying options for github.com
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 *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home//.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home//.ssh/known_hosts2'
debug2: resolving "github.com" port 443
debug3: resolve_host: lookup github.com:443
debug3: ssh_connect_direct: entering
debug1: Connecting to github.com [140.82.121.4] port 443.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: Connection established.
debug1: identity file /home//.ssh/id_rsa type 0
debug1: identity file /home//.ssh/id_rsa-cert type -1
(several more attempts to load identity files, all fail with -1)
debug1: Local version string SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10
kex_exchange_identification: Connection closed by remote host
Connection closed by 140.82.121.4 port 443
Seems to me like my SSH agent is not even offering my public key but also not complaining about it missing.
Any suggestions what I could check further ?
Asked by Amnu
(11 rep)
Sep 5, 2024, 04:30 PM