1

I have created a new GIT repository in my server at /home/myuser/.git/project.git. I found ssh key for git from C:\Users\Toshiba\.ssh\github_rsa.pub & appended with server's authorized_keys file.

when i try to do git clone using ssh it fails as below.

$ git clone ssh://myuser@mysite.net:2888/home/myuser/.git/project.git

Cloning into 'project'...
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.

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

Could you please help me in resolving this issue.

logan
  • 7,946
  • 36
  • 114
  • 185

1 Answers1

1

If your public/private key doesn't have the standard name C:\Users\Toshiba\.ssh\id_rsa(.pub), but C:\Users\Toshiba\.ssh\github_rsa.pub, then you need an ssh config file

Host mysite
   Hostname mysite.net
   User myuser
   Port 2888
   IdentityFile C:\Users\Toshiba\.ssh\github_rsa.pub 

That would allow you to do

git clone mysite:/home/myuser/.git/project.git

Test it first wih ssh -Tvvv mysite, and then ssh mysite ls.

Make sure the environment variable %HOME% is defined to C:\Users\Toshiba

You have another example in "SSH error on push to an existing project Permission denied (publickey)"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250