Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git clone using public private keys

I have been trying for ages to clone a git repository using public and private keys for authentication instead of password. I generated my keys using puttygen on windows. I cannot log in from windows or from linux. I keep getting the following error:

git clone [git repo directory]

Cloning into papers...

Enter passphrase for key '/.ssh/id_dsa':

Permission denied (publickey).

I first created my private key with a passphrase, but that didn't work, after I resaved the private key without a passphrase (using puttygen) but it still didn't work.

How do I fix this problem? I have been trying to work it out for so long but now am just totally stuck.

Thanks a lot!

like image 934
tree-hacker Avatar asked Mar 23 '26 17:03

tree-hacker


1 Answers

  1. You must to know two things: private key can be created is putty and openssh-compatible formats - and these formats are not freely exchangeable (client-side tool can understand putty or openssh only), Linux understand only openssh-type keys
  2. You must use on client-side (additional) tool, which provide non-interactive authentication by key on request

A consequence of points 1 and 2

Windows-client: run pageant, load putty's private key into it (enter passphrase for key). Maybe you have to redefine in Git ssh-client from system to plink

Linux-client: on Windows-host load putty-type private key into puttygen and export into openssh-key. Save this file in Linux-box as /.ssh/id_dsa. Run ssh-agent, enter password once. ssh-agent will use password for key for all requests during session

PS: Debug your issues with the help of Github ssh-related docs and testing shell

like image 173
Lazy Badger Avatar answered Mar 25 '26 07:03

Lazy Badger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!