Search code examples
gitssh-keysubuntu-10.10gitolite

How to set the ssh key to the user git while installing gitolite on Ubuntu 10.10


I am trying to configure a git server on an Ubuntu Server 10.10 with gitolite and following the tutorial On Ubuntu for Gitolite.

I first create a user git with the following command : sudo adduser git
I set a password to this user.

Then, I generate a rsa key with the command : ssh-keygen, I call it id_rsa_git.

After that, I want to associate it to the user git with the following command :

ssh-copy-id -i ~/.ssh/id_rsa_git.pub git@localhost

The prompt asks me the password for the user git, and after giving it (the good one), I get the following error :

Permission denied, please try again.

I cannot go further since I am pretty noob in Linux administration. Can anybody help me ?

Thanks.


Solution

  • Simply try to copy your key:

    cd

    sudo cp .ssh/id_rsa_git.pub ~git/.ssh/authorized_keys

    If doesn't work, open an other console:

    sudo su - git

    cd

    mkdir .ssh

    You can close this console.

    sudo chown git:git ~git/.ssh/authorized_keys

    sudo chmod 600 ~git/.ssh/authorized_keys

    And now all will be good (no need of ssh-copy-id)