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

ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly

I recently set up a gitosis git server on my Linux box.  I added a new project and then found that I could no longer push to the gitosis-admin project.

If you’ve searched for a solution to this problem and you’ve tried everything you may have the same problem that I had.  You have probably verified all permissions, checked the gitosis login with ssh -vvv user@host etc.

The problem is that I added stanzas for each project for a given user like:

[group gitosis-admin]
writable = gitosis-admin
members = me@host

[group gitosis-admin]
writable = project_one
members = me@host

[group gitosis-admin]
writable = project_two
members = me@host

This is wrong.  It needs to be like this, with all the projects on the same line:

[group gitosis-admin]
writable = gitosis-admin project_one project_two
members = me@host

Hopefully this will save some of you some time.  I changed this directly on the server to get it working again.

9 thoughts on “Gitosis ERROR:gitosis.serve.main:Repository read access denied

    1. I may be mistaken, but I think you can’t repeat user names in the config file, meaning you have to reference them on second mention.

      Try changing the above file to:

      [group gitosis-admin]
      writable = gitosis-admin
      members = me@host

      [group gitosis-admin]
      writable = project_one
      members = @gitosis-admin

      [group gitosis-admin]
      writable = project_two
      members = @gitosis-admin

    2. I may be mistaken, but I think you can’t repeat user names in the config file, meaning you have to reference them on second mention.

      Try changing the above file to:

      [group gitosis-admin]
      writable = gitosis-admin
      members = me@host

      [group gitosis-admin]
      writable = project_one
      members = @gitosis-admin

      [group gitosis-admin]
      writable = project_two
      members = @gitosis-admin

  1. For me, gitosis kept throwing “Repository read access denied”, and (with “loglevel = DEBUG” added in gitosis.conf) I never made it beyond the “Access check” writeable/writeable/readonly cascade (rather than haveAccess “Access ok” log).
    Turned out it was exactly because the *filename* (user specification) of the public key in gitosis-admin repo’s keydir/ sub directory did not *exactly* match its corresponding user description in the file’s content (filename failed to list the domain part which was listed within the file however). Pushing this single file rename commit made it work, after having had issues with it for dozens of minutes.

    Had wanted to embark on a gitolite migration but that turned out so awkward (plus the Debian package version is rather stale anyway) that I decided to put that on hold until gitosis is truly judged unfit for the job (never run a changing system or some such).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s