Unable to clone any git repo even after adding ssh keys

Viewed 5332

I am trying to clone a repo from github. To do that

  1. I have generated a ssh key using: ssh-keygen.

  2. Then I added the content of ~/.ssh/id_rsa.pub to my keys in github account.

Even after that I am unable to clone any repo. I am getting following error:

ssh_exchange_identification: read: Operation timed out
Please make sure you have the correct access rights
and the repository exists.

In this regard, I have gone through a few posts here, but unable to fix.

NOTE: This error I am facing even after removing SSH key from my github account.

EDIT: When I am doing "ssh -T git@github.com", I am getting the same error:

ssh_exchange_identification: read: Operation timed out

As suggested in: https://help.github.com/en/articles/error-permission-denied-publickey, while executing following commands:

 1. ssh-add -l ==> The agent has no identities.
 2. ssh-add -l -E md5 ==> The agent has no identities.
1 Answers

You get this error for one of these 3 reasons:

  1. when you have authentication/authorization problems
  2. When you have an internet access problem
  3. SSh problems

Do the following:

first in your terminal run ssh -T git@github.com if you see your GitHub username in response. you know that you are authenticated properly if not...

first check internet access: make sure you can access GitHub by cloning a public repo (any repo) by SSH (not https). if you fail here you have problems with SSH or internet connection

if this step passed, try to clone one of your other private repos by ssh. if you failed. you have an authentication problem and your ssh key is wrong. (try again by https and compare the results)

if this step passed, try to clone this repo by https (not ssh). if you failed. you have an authorization problem and you have no access to this repo

Related