0

I am trying to clone git repo using ssh I have git SSH fiel copied from another system where it is working , but on this system it is giving error -

Cloning into 'repo'... Permission denied (publickey). fatal: Could not read from remote repository.

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

Sagar
  • 23
  • 6

2 Answers2

0

Check your private key permission first, ssh would not allow if it is accessible by others.

$ ls -l ~/.ssh/id_rsa

Then set the appropriate permissions

$ chown user:user ~/.ssh/id_rsa*
$ chmod 600 ~/.ssh/id_rsa
$ chmod 644 ~/.ssh/id_rsa.pub
letthefireflieslive
  • 11,493
  • 11
  • 37
  • 61
0

Looks like you don't have the correct private key.

have you created a pair of private-pubic keys? if not you can follow the instructions here

Are you also using putty? (you were asked in the installation of Git). If so, follow the instructions above but generate the key with puttygen (and not with the command

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

)

after creating a pair, convert the putty-created public key to OpenSSH format and then upload it to GitHub as your key. The last step is to configure putty's default settings to use the private key generated by puttygen

enter image description here

Bar Horing
  • 5,337
  • 3
  • 30
  • 26