-2

I want to clone a repository from my server but I want to use SSH keys.

How can I get this done ?

1
  • I generated a couple of private and public keys on cpanel and put the public one under .ssh/ida_rsa.pub (my locale machine) Aug 28, 2014 at 9:14

1 Answer 1

0

You need to put your public key into the file $HOME/.ssh/authorized_keys where $HOME is the folder of the user which runs the Git server (look at your clone URL; the user is the part between before the @).

The tool ssh-copy-id might help.

If you use Github, then you can find options to set up SSH in your user's settings.

Also make sure you have both the public and private key on the local account; otherwise, SSH can't generate the secrets necessary to establish the secure authentication.

5
  • Yes this is done on the server side but how my locale machine can connect to the server when i type for example : git clone user@domain:path/to/repository.git , actually it asks for a password Aug 28, 2014 at 9:25
  • Password or pass phrase? Aug 28, 2014 at 9:27
  • Password : git clone user@domain:path/to/repository.git Cloning into 'repository'... user@domain's password: Aug 28, 2014 at 9:31
  • Then the public key isn't installed (correctly) in the home directory of user on domain. Aug 28, 2014 at 9:31
  • 1
    The private key is the one you need locally (id_rsa), and the public key needs to be added to the authorized_keys file on the server.
    – Ikke
    Aug 28, 2014 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.