Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to get Gitosis working on my Ubuntu server (from a Win7 client). It's installed, and I can connect to it via SSH, however, if when I try and push a new project, I get the following error:

ERROR:gitosis.serve.main:Repository read access denied

I since tried clearing my /home/git/ folder and starting again - but now I get that same error even when I try and grab the gitosis-admin project.

Any ideas what could cause this?

[edit] Adding the debug flag to the config file gives me this:

C:\sandbox>git push origin master
DEBUG:gitosis.serve.main:Got command "git-receive-pack '/home/git/repositories/sandbox'"
DEBUG:gitosis.access.haveAccess:Access check for 'Dan@DAN-PC' as 'writable' on 'home/git/repositories/sandbox'...
DEBUG:gitosis.group.getMembership:found 'Dan@DAN-PC' in 'gitosis-admin'
DEBUG:gitosis.access.haveAccess:Access check for 'Dan@DAN-PC' as 'writeable' on 'home/git/repositories/sandbox'...
DEBUG:gitosis.group.getMembership:found 'Dan@DAN-PC' in 'gitosis-admin'
DEBUG:gitosis.access.haveAccess:Access check for 'Dan@DAN-PC' as 'readonly' on 'home/git/repositories/sandbox'...
DEBUG:gitosis.group.getMembership:found 'Dan@DAN-PC' in 'gitosis-admin'
ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly

[edit2]

To add extra information to this - I've just tried Gitolite and got a similar error:

Cloning into gitolite-admin...
R access for home/git/repositories/gitolite-admin DENIED to dan
(Or there may be no repository at the given path. Did you spell it correctly?)
fatal: The remote end hung up unexpectedly

That's using the same "git" user and keys. I tried changing the directory permissions, but that didn't help.

share|improve this question

3 Answers 3

Any ideas what could cause this?

This usually indicates either (a) a configuration error in your gitosis.conf, or (b) a missing public key in your Gitosis keydir. To further diagnose the problem:

  • Check out the admin repository. Since you can log into the server, you can run:

    git checkout /path/to/gitosis/repos/gitosis-admin.git
    
  • This will give you a directory called gitosis-admin. Inside this directory is your gitosis.conf file.

  • Add the following to the top of the file:

    [gitosis]
    loglevel = DEBUG
    
  • Commit your changes and push back to the original repository:

    git commit -m 'enabled debug logging' -a
    git push origin master
    

Now when you push to your gitosis installation, you'll get verbose debug logging that should help diagnose the problem. If that doesn't point you at the problem, post the debug output here and we'll help you figure it out.

share|improve this answer
    
Thanks for that. I've editing my original post with the output. Not sure if it gives anything though. However, you mention about a key directory - I did see this before I reinstalled gitosis (ie. when I was getting the error pushing a new project, rather than when checking out the gitosis-admin project). However, I can't see it on the server when looking the gitosis-admin directory now. Could this be it? I've just tried manually on the server creating that directory and putting my public key in it, but that's not made a difference. –  Dan Jan 30 '11 at 9:40

I highly recommend you drop gitosis and switch to gitolite. Gitosis has been deprecated and does not appear to be maintained anymore while gitolite is very actively maintained and supported. Gitolite does everything gitosis can do but does it better, including detailed errors instead of the vague errors you get from gitosis.

share|improve this answer
    
Will look into this, but would like to know what's going on with Gitosis anyway out of curiosity. –  Dan Jan 30 '11 at 9:42
    
Interesting! I tried gitolite, and got a very similar error! (see my edit in my initial post). Could this be a problem with my "git" user? –  Dan Jan 30 '11 at 10:30
    
Did you forget the .git at the end of the remote repository name? –  Arrowmaster Jan 30 '11 at 16:22

Turned out it was because I was using the same username as my main SSH shell logon (dan). So I changed my git admin to use the same SSH key pair, and it seems to work fine now. Also now using Gitolite as recommended by Arrowmaster.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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