I have successfully created gitolite-admin.git
repo on server (say) 10.107.105.13
. I can clone this repo on my local machine (say) 10.14.42.7
by issuing git clone gitolite@10.107.105.13:gitolite-admin
. I had to add some lines in .ssh/config
file to make sure that correct private key is used.
Then I have added a user dilawar
to conf/gitolite.conf
file and a appropriate key dilawar.pub
to keys
folder. I have added and commited this commit to the gitolite-admin
repo. I have also added one more entry in .ssh/conf
file so that a correct private key is used. But when I try to do git clone dilawar@10.107.105.13:testing
, gitolite asks for the password. I am under the impression that I do not have to create user dilawar on 10.107.105.13. I have checked by logging into server that repository testing.git exists as well public-key dilawar.pub
has been added to .ssh/authorized_keys
.
I have also tried ssh -vvvv dilawar@10.107.105.13
to check if the correct file is being offered. Here is my .ssh/conf
file.
HostName 10.107.105.13
User gitolite
IdentityFile ~/.ssh/gitolite
Host 10.107.105.13
HostName 10.107.105.13
User dilawar
IdentityFile ~/.ssh/id_rsa
What I am doing wrong?
In your config file, I see:
That is wrong. ssh communication to a gitolite server are always done with the same account (here
gitolite
).What changes is the private key used, which will help gitolite determine your identity.
What you
~/.ssh/config
file should look like is:For cloning
gitolite-admin
, you would use:For cloning a repo
dilawar
has access to:See more at "Gitolite: adding user not working, and DENIED by fallthru when cloning as root?".
See also "how gitolite uses ssh"
I had to edit
/etc/ssh/sshd_config
and addgit
(the user) to the line which begins withAllowUsers
. Then I had to add git to a sysadmin group that was also allow on sshd_config's line that begins withAllowGroups
.Don't forget to restart the ssh daemon with
sudo service ssh restart
.Note : I didn't have to
ssh-copy-id
or add the public key to/home/git/.ssh/authorized_keys
as suggested before (gitolite's developer recommends against this btw.)I have got it working by cloning the repository using the gitolite username.
If keys are added successfully then further pull and push will go smoothly.
I am accepting VomC answer as a better answer.
I had the same problem, with a different solution because of my config. I setup my gitolite user as “git” so I needed to du
git clone git@server:repo.git