1

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.

AndreasInfo
  • 1,062
  • 11
  • 26
  • Please write more details about your problem, All steps that you make is correct and should clone without any problem. you can solve this problem by generating ssh-key again with default name of ssh-key , copy public key to remote host and try to clone again – Eng_Farghly Nov 28 '22 at 23:36
  • `140.82.121.3` is a GitHub load balancer, so everything looks OK, but obviously it's not working. The "connection closed" without any message suggests (though does not prove) an issue on their end. Use `ssh -Tv git@github.com` to trace any ssh traffic that actually did make it through. – torek Nov 29 '22 at 09:59

1 Answers1

1

Check here, to get an idea on how the cloning process works.

  • ensure that you are providing public key in the GitHub console

  • check the connection using ssh -T git@github.com, in case of any errors check here

  • verify that public and private keys are present in the .ssh folder and optionally known_hosts

  • debug using ssh -vvv git@github.com

That should resolve your issue.

not2qubit
  • 14,531
  • 8
  • 95
  • 135
  • try these [https://www.youtube.com/watch?v=ft_SxeSXdwQ] and [https://katiehyenychoi.medium.com/what-does-ssh-connect-to-host-github-com-port-22-connection-timed-out-mean-8cd68a0ea5c] – Balaji Gandham Nov 30 '22 at 04:25