Gitolite with LDAP not working

2019-03-31 06:35发布

I am new to gitolite. I am trying to do a very simple test with gitolite. I have setup my repository called "test_repo". Please note that I have not modified anything else otherthan what I have stated below. I can see this repo in gitweb. This is the repo configuration

repo test_repo
    RW+     =   @all

Now I want to clone this repo. I have ldap access to server. By my understanding of @all, it should allow me to do this.

when I issue

git clone git@myserver:repositories/test_repo.git 
#I know this is wrong. But I just wanted to test as the above did not work

or

git clone git@myserver:test_repo.git

its asking for password. I have followed this guide http://sharadchhetri.com/2013/05/31/how-to-create-own-git-server-with-gitolite-and-gitweb-in-ubuntu/, which does not set a password for git user

When I issue

git clone myname@myserver:test_repo.git

I am getting the following error

fatal: 'test_repo.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I also tired to clone the default repo "test_repo.git". But I am getting the same error.

I also tired this

git clone myname@myserver:/home/git/repositories/testing.git

then cloning is working. But when I do git push -u origin master some modified files I am getting

error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
! [remote rejected] master -> master (n/a (unpacker error))

Note: I have not added any user in conf file

Any help is appreciated.

2条回答
Root(大扎)
2楼-- · 2019-03-31 06:56

just try

ssh git@hostname-or-ip

This should not ask password; it can ask passphrase. This will also emit list of repositories you have access to.

BTW - username@localhost in git clone command is grossly wrong

查看更多
劳资没心,怎么记你
3楼-- · 2019-03-31 06:58
 git clone myname@myserver:/home/git/repositories/testing.git
  • that completely bypass gitolite, which isn't called
  • use the wrong account 'myname' which has no right to read the git account folders.

What should work is:

 git clone git@myserver:test_repo.git
 or
 git clone git@myserver/test_repo.git

You shouldn't specify the 'repositories' folder (gitolite knows where the repo is supposed to be)

That supposes that ssh -Tvvv git@myserver works (ie do not ask password).
Make that ssh work first, and then try again the git clone.


As I say in the comment, LDAP and ssh are both authentication mechanism, so you can use one or the other, not both:

If the ssh works, but the clone doesn't work, then you need to have a look in the gitolite logs at ~git/.gitolite/logs

I could not find anything useful in the log. Moreover I did a tail -f of the log file. Its not even updated when I try to clone.

That means the issue is on the ssh level, not calling properly gitolite: that is in ~git/.ssh/authorized_keys, and happens if you add an ssh key manually directly in it, instead of adding through the keys folder of the gitolite-admin repo and pushing back that repo to the gitolite server (which triggers the update of said ~git/.ssh/authorized_keys file).

I think that could be the reason. I have no idea what just happened. I can even clone gitolite-admin, in admin server (this was working earlier).
I will re install every thing (because I think I messed up a lot with config files by now).

查看更多
登录 后发表回答