linuxgitmanjaro

Can not clone Github repo using SSH


I have freshly installed Linux Manjaro with Plasma Desktop. Cloning my repos from Github using SSH gives me some trouble. I tried

[andreas@Bixente ~]$ ssh-add -l
Could not open a connection to your authentication agent.
[andreas@Bixente ~]$ eval "$(ssh-agent -s)"
Agent pid 5346
[andreas@Bixente ~]$ ssh-add -l
The agent has no identities.
[andreas@Bixente ~]$ ssh-add ~/.ssh/github
Identity added: /home/andreas/.ssh/github (andreas@Bixente)
[andreas@Bixente ~]$ git clone git@github.com:Username/project.git ~/TestDir
Cloning into '/home/andreas/TestDir'...
Connection closed by 140.82.121.3 port 22
fatal: Could not read from remote repository.

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

What am I doing wrong? I am sure I put the key on Github. Furthermore, it seems like I have to do this after every restart.

Edit: Nothing really works. I followed step by step, even created and used another key with default name. Still no solution.

[andreas@Bixente .ssh]$ ssh-add id_ed25519
Identity added: id_ed25519 (andreas@Bixente)
[andreas@Bixente .ssh]$ ssh -Tvvv git@github.com
OpenSSH_9.1p1, OpenSSL 3.0.7 1 Nov 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/andreas/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/andreas/.ssh/known_hosts2'
debug2: resolving "github.com" port 22
debug3: resolve_host: lookup github.com:22
debug3: ssh_connect_direct: entering
debug1: Connecting to github.com [140.82.121.3] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
debug1: connect to address 140.82.121.3 port 22: Connection timed out
ssh: connect to host github.com port 22: Connection timed out

Edit: I followed the exact same steps to my friends machine (MacBook Air) without any problems. But I recognized, I was never asked to add Github to known_hosts.


Solution

  • Actually this was a hard to find Manjaro-MacBook related problem. More info see here: https://forum.manjaro.org/t/cant-use-ssh-on-freshly-installed-manjaro-with-macbook-pro-2012-wi-fi/127982/42