-1

I am using Windows with Git (both Github and a local GitLab instance), but I cannot clone from either service.

Following is the error I get with a public repo on Github.

Cloning into 'xxx-java'...
The authenticity of host 'github.com (140.82.118.3)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpxwxE1IGOCspscxdCARLsdKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,140.82.118.3' (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

Seems to me like something is wrong with my SSH keys, but I created them exactly as told in the Gitlab documentation.

What am I missing? (It should be noted that cloning over HTTPS works fine).

jww
  • 97,681
  • 90
  • 411
  • 885
john
  • 1,561
  • 3
  • 20
  • 44
  • Follow this proces 1. https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent 2. https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account Then run `ssh git@github.com`. Let us know the output – Ganesh Satpute Sep 25 '19 at 12:33
  • 1
    Possible duplicate of [GitHub: Permission denied (publickey). fatal: The remote end hung up unexpectedly](https://stackoverflow.com/questions/3617113/github-permission-denied-publickey-fatal-the-remote-end-hung-up-unexpectedl) – phd Sep 25 '19 at 14:40
  • https://stackoverflow.com/search?q=%5Bgit%5D+Permission+denied+publickey – phd Sep 25 '19 at 14:40

2 Answers2

0

Check whether you have correctly copied the public key to the GitHub account. Public key normally starts with "ssh-rsa" and an encoded key. The same thing happened to me, the reason was I had not copied the public key correctly.

Ashane.E
  • 109
  • 10
0

First of all, I recommend checking some standard things like:

  1. login as the correct user in your system,
  2. have the right private key in the right location in your system,
  3. try to connect with the correct username, hostname, and port,
  4. have the public key in the right location (and for the right user) in the external server,
  5. restarted the ssh service at your computer:

or make sure https also.

ssh -vT git@github.com

Ravi Chauhan
  • 1,409
  • 13
  • 26
  • `ssh -vT git@github.com` actually fails with `debug1: No more authentication methods to try. git@github.com: Permission denied (publickey).` – john Sep 25 '19 at 14:01