Search code examples
installationcentosgitolite

Install gitolite v3 on the Centos 6.4. The second user is asking a password


Please help me to understand what i am doing wrong. I have server on CentOS 6.4 and I need to install gitolite v3. What am i doing? by the first i am install one using next command:

yum install git* perl-Time-HiRes

useradd -m --system --shell /bin/bash --user-group gitolite

su - gitolite

mkdir bin


echo "PATH=$HOME/bin:$PATH" > .bash_profile

source .bash_profile

ssh-keygen -t rsa

cp .ssh/id_rsa.pub ./gitolite.pub

git clone git://github.com/sitaramc/gitolite

gitolite/install -ln

gitolite setup -pk gitolite.pub

Install was successful. Than I clone gitolite-admin repositories:

git clone gitadmin:gitolite-admin
cd gitolite-admin/keydir

And generate public key for the new user(lodar.pub)

ssh-keygen -t rsa -f lodar
mv ./lodar ../../.ssh/lodar

Than i edit conf/gitolite.conf:

repo gitolite-admin
   RW+   = gitolite
repo testing
   RW+   = @all
repo   empty
   RW+   = lodar

Commit all changes:

git add keydir/lodar.pub
git commit -m 'add user lodar and new repo empty'
git push

And that is all. Push was successful too. After all manipulation i created .ssh/config

Host gitadmin
    User gitolite
    Hostname 192.168.0.1
    Port 22
    IdentityFile ~/.ssh/gitolite

Host gitlodar
    User gitolite
    Hostname 192.168.0.1
    Port 22
    IdentityFile ~/.ssh/lodar

But if i try to connect using

ssh gitlodar info
lodar@192.168.0.1's password:

i must to enter the password.

ssh gitadmin info
hello, gitolite, this is gitolite@lodar-14452 running gitolite3 v3.5.1-4-g2f48a3e on git 1.7.1
R W   gitolite-amdin
R W   testing

What am i doing wrong?


Solution

  • You did:

    mv ./lodar ../../.ssh/lodar
    

    I supposed you meant

    cp ./lodar.pub ../../.ssh/
    mv ./lodar     ../../.ssh/
    

    Because if you don't copy the public key in ~/.ssh, you wouldn't be able to use it in an ssh session.

    But the other mistake is in your ~/.ssh/config file:

    Host gitlodar
        User gitolite          # not loadar!
        Hostname 192.168.0.1
        Port 22
        IdentityFile ~/.ssh/lodar
    

    See "How do programs like gitolite work?":
    The idea is to always use the same user to connect to the gitolite server (in your case, connect as 'gitolite'), and open an *non-interactive shell.
    The force-command ssh line will call the gitolite script with a parameter representing the name of the user (here 'loadar'), because that named is registered with the public key in the ~gitolite/.ssh/authorized_keys.