Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > ba9fe7781d529b2e7b31d8489f5e0b8e > files > 26

gitolite-1.5.3-2.fc14.noarch.rpm

<h1>when gitolite is overkill</h1>

<p>Note: I wrote this to help people for whom gitolite is genuinely overkill.  I
believe it will all work, but YMMV.</p>

<hr />

<p>You don't always need something like gitolite.  If you have a fixed (or very
rarely changing) number of users, and all of them have full access to all your
repos, you can use plain Unix permissions to get a lot of this done:</p>

<ul>
<li><p>dedicate a userid (say "git") to host all your repos.  This user will also
have a group (normally called "git" on most distros I think)</p></li>
<li><p>create a directory that is accessible (at least "r" and "x" permissions)
to the group "git", all the way upto the root.  (That is, if the directory
you chose is /home/git/repos, then /, /home, /home/git, and
/home/git/repos must all be "g+rx").</p></li>
<li><p>create all repos in this directory, as the "git" user, using the following
command:</p>

<pre><code>git init --bare --shared reponame.git
</code></pre></li>
<li><p>For each user who needs access to the repos, add them as members to the
"git" group also.  On Mandriva this is:</p>

<pre><code>usermod -G git username
</code></pre>

<p>Don't forget that <code>-G</code> <em>replaces</em> the list of supplementary groups for the
user, so be sure to first check if he is already member of some groups and
keep those in the command (comma-separated).</p></li>
</ul>

<p>And that's basically it.  The "init --shared" will create the repos with
"chmod -R g+s".  If you have existing repos where you forgot (or didn't know)
the "--shared" argument, do this on each of them:</p>

<pre><code>    cd reponame.git
    git init --shared --bare
    chmod -R g+w .
    chmod g+s `find . -type d`
</code></pre>

<p>I think that should do it.</p>

<hr />

<p>You can do more complex things using Unix acls.  If you do, and feel like
writing it up, send it to me and I will add it here (with credit given of
course).  Personally, I can't be bothered -- once you have differing needs for
different people, you really need gitolite anyway, because you probably need
different rights for branches as well and Unix ACLs can't do that.</p>