Gitosis and read-only Git repositories

Monday, July 26th 2010, 20:50

When I’ve started working with Git, besides using the quick how-to guides from the official site, I’ve also wanted to read a more detailed book about how this distributed VCS tool should be used in order to benefit from all of its functionalities. One of these books is Pro Git by Scott Chacon, from Apress. The e-book version I own dates from September 2009, although its content is freely available (with the proper updates and revisions) here.

One of the most interesting tools for Git is Gitosis, an application which allows you to automate repository management and to have your own hosted repo on one of your servers (click here to install it on Ubuntu; a good start-up guide can be found here). In my case, this server is Geordi. While I do use GitHub too, Gitosis manages my non-public projects. Not only that Gitosis creates your repositories on the server once you need them, but it also handles user access allowing to have multiple users (commiters or followers) with read/write rights depending on the project.

Today I wanted to allow Tudor to be able to clone one of my private repositories but in the same time I didn’t want to give him push permissions. The edition of Pro Git I have listed this configuration for the previous job:

[group groupName]
writable = repoName
members = user1 user 2 user3

[group groupName-readonly]
readable = repoName
members = user 4

With this set-up, every time when Tudor tried to clone my repository, Gitosis would respond with:

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

The problem was on the highlighted line. It seems that the correct keyword for setting read-only user access is nothing other than readonly. With that put up in place everything worked as it should from the beginning. Although the online book now uses the correct keyword, you might still find PDF files of the book with the wrong example in which case you now have a solution.

Keep on pushing! ;)

You might also like:

7 Comments

  • I still don’t get why you don’t use Github like everybody else…

  • But you can have private repos. It’s 12 bucks…don’t be cheap :)

    • Besides not having an UPS, I don’t see any other disadvantage of using my own private server for hosting my private Git repositories. Yeah, GitHub provides a shiny web interface and some graphs, but it’s nothing more than a wrap around git.

      I really enjoy using GitHub for my open-source stuff but I don’t (yet) feel the need of buying features that I already have for free.

  • Why haven’t you listed the correct file ? eventually doing something like

    readable readonly

    It would have been easier to understand :)

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


CODE EXAMPLES: When you want to include source code or terminal output, please use the the following tags like in the next example:

    [language]
    code lines
    [/language]
	

where you substitute language with the programming laguage used throught the code example (for terminal output that would be bash), e.g:

    [bash]
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    [/bash]
	

To see a list of all the supported languages, please check this page.

If you want to include code bits inline, please use the code tags like in the following example:

    The <code>$USER</code> variable holds the current logged in username.
	

Projects that I support

Recent Comments

  • nope said:
    yeah that was my first thought too, but: mount: warning: seems to be mounted read-write. too bad, would have been just perfect. more»
  • Klaus Deiss said:
    Dear Radu, I tried it on Ubuntu 10.0.4.2 and 10.0.4.3 with different kernel versions (amd64 server 2.6.32 kernel). No... more»
  • scompo said:
    Nope.. Now it’s not working again.. This printer it’s a real pain in the butt.. The other hp printer I had... more»
  • Dmitrij said:
    Thank you Peter and Patrice. Could you please post the updated script? more»
  • hd_flash_pains said:
    didn’t work for me more»

Recent Tweets

Bear