5 Gitolite allows you to setup git hosting on a central server, with
6 fine-grained access control and many more powerful features.
10 Gitolite is an access control layer on top of git. Here are the features that
13 * Use a single unix user ("real" user) on the server.
14 * Provide access to many gitolite users:
15 * they are not "real" users,
16 * so they do not get shell access.
17 * Control access to many git repositories:
18 * read access controlled at the repo level,
19 * write access controlled at the branch/tag/file/directory level,
20 including who can rewind, create, and delete branches/tags.
21 * Can be installed without root access, assuming git and perl are already
23 * Authentication is most commonly done using sshd, but you can also use
24 "smart http" mode if you prefer (this may require root access for the
27 # why might you need it?
31 Git by itself does not do any access control -- it relies on the transport
32 medium to do authentication ("who are you?"), and on OS file permissions to do
33 authorisation ("what are you allowed to do?").
35 Git also comes with a program called "git-shell" which can act as a restricted
36 login shell if you don't want users getting a proper shell. Using this and
37 judicious use of Unix groups, you can allow some people read-only access while
38 others get read-write access, etc. This is probably sufficient if your needs
39 are simple and don't change too often.
41 However, gitolite does this much better, and offers many more features.
45 Gitolite is useful in any server that is going to host multiple git
46 repositories, each with many developers, where "anyone can do anything to any
47 repo" is not a good idea. Here're two examples to illustrate.
51 This first example has 3 repos and 3 developers with different levels of
52 access to each repo. It's a very simple, readable, syntax, and makes it easy
53 to answer questions like "what repos can bob push to" (answer: only 'bar').
71 This second example allows different levels of access to different branches
72 and tags for different developers:
79 RW refs/heads/tags/v[0-9] = ashok
84 Gitolite has many more features, as you might guess from the amount of
85 documentation (see links in the nav bar at the top). Here's a quick sample:
87 * Very powerful rule language (rules most often based on branch/tag name, or
88 files/directories touched, but many other factors can be used, such as
89 size of changed files, number of changed files, etc.).
90 * Convenience features for writing the rules (repo groups, user groups, get
91 user group info from LDAP, include files, macros...)
92 * Highly customisable and scriptable, especially custom commands for users.
93 Many built-in commands and options.
94 * Powerful and flexible mirroring system.
95 * Users can create their own repos and set access rights (if you allow
98 ## alternatives to gitolite
100 ### unix permissions and ACLs
102 If you're a masochist, you could probably do example 1 with Unix permissions
103 and facls. But you can't do example 2 -- git is not designed to allow that!
105 Here are some other disadvantages of the Unix ACL method:
107 * Every user needs a userid and password on the server.
108 * Changing access rights involves complex `usermod -G ...` mumblings
109 (I.e., the "pain" mentioned above is not a one-time pain!)
110 * *Viewing* the current set of permissions requires running multiple
111 commands to list directories and their permissions/ownerships, users and
112 their group memberships, and then correlating all these manually.
113 * Auditing historical permissions or permission changes is impossible.
115 ### Gerrit Code Review
117 The best real alternative to gitolite is Gerrit Code Review. If code review
118 is an essential part of your workflow, you should use Gerrit.
120 Here're some high level differences between gitolite and Gerrit (as of about
123 **Size**: 3000+ lines of perl versus of 56,000+ lines of Java
125 **Architecture**: Gitolite sits on top of "standard" git and openssh, which
126 are assumed to already be installed. Gerrit includes its own git stack (jgit)
127 and sshd (Apache Mina). In Java tradition, they all come bundled together.
129 (Corollary: As far as I know jgit does not support the same hooks that 'man
130 githooks' talks about).
132 Gitolite uses a plain text config file; gerrit uses a database.
134 **User view**: Gitolite is invisible to users except when access is denied.
135 Gerrit is much more visible to devs because of its role in enforcing code
136 review, approvals, and workflow.
138 On a related note, gitolite does not do anything special with signed or
139 annotated tags, nor does it check author/committer identity. However, it is
140 trivial to add your own code to do either (or if someone contributes it, to
141 just "enable" what ships with gitolite in a disabled state).
143 ### gitlab, gogs, gitblit, and others
145 There are several alternatives which offer a full web-based GUI, for
146 administrators or users or both. They also offer a lot of enterprise features
147 (for example LDAP integration), and social coding features (issue trackers,
148 discussions, comments on code, pull requests, etc.)
150 However, they are unlikely to be as [customisable](non-core) as gitolite is,
151 if you care about that sort of thing.
155 At a very high level, gitolite relies on **sshd** (or **httpd** if you're
156 using the smart http mode) to authenticate the user and supply the username.
157 Based on this, and the command given, it decides whether to allow or deny the
160 Consider a push command in ssh mode. Normally (i.e., without gitolite) this
161 would invoke `git-receive-pack` on the server, and the flow would be somewhat
162 like this (left side is client, right side is server):
168 When you install gitolite and setup the user, gitolite sets up ssh to
169 **force** the `gitolite-shell` command to run first, instead of the command
172 The `gitolite-shell` program uses the username supplied by ssh, and the repo
173 name in the command, to decide if the user has write access to the repo or
176 If he does have *some* write access, git-receive-pack is called, but that's
177 not the end of the story. The branch/tag/file(s) he is pushing also need to
178 be checked, and gitolite sets up the update hook on the repo to do that.
182 A more detailed explanation, with figures, is [here](how.html).
187 If you're using gitolite and find it very useful in some way, I would love
188 to describe your use of it or add a link to your own description of it
189 here. Of course, you can anonymise it as much as you need to.
191 The **Fedora Project** controls access to over 10,000 package management
192 repositories accessed by over 1,000 package maintainers [using
193 gitolite][fedora]. This is probably the largest *confirmed* gitolite
194 installation anywhere. The whole "big-config" option back in v2 (in v3
195 this is the default!) was initially done for them (their config file was so
196 big that without the big-config changes gitolite would just run out of memory
199 [fedora]: https://lists.fedoraproject.org/pipermail/devel-announce/2010-July/000647.html
201 The **KDE project** [uses][kde] gitolite (in combination with redmine for
202 issue tracking and reviewboard for code review). Apart from the usual access
203 control, the KDE folks are heavy users of the "ad hoc repo creation" features
204 enabled by wildrepos and the accompanying commands. Several of the changes to
205 the "admin defined commands" were also inspired by KDE's needs. See [section
206 5][kdes5] and [section 6][kdes6] of the above linked page for details.
208 [kde]: https://community.kde.org/Sysadmin/GitKdeOrgManual
209 [kdes5]: https://community.kde.org/Sysadmin/GitKdeOrgManual#Server-side_commands
210 [kdes6]: https://community.kde.org/Sysadmin/GitKdeOrgManual#Personal_repositories
211 [kdera]: https://permalink.gmane.org/gmane.comp.kde.scm-interest/1437
213 **Prof. Hiren Patel** of the University of Waterloo is responsible for the
214 existence of the fairly popular "[wildrepos](wild)" feature. The
215 documentation was pretty much written with his use case in mind, but of course
216 it turns out to be useful for a lot of people, as you can see from the
217 previous para on KDE's use of gitolite.
219 In fact, he surprised the heck out of me once by saying that if it hadn't been
220 for this feature, he might not have used git itself -- which is a pretty
221 serious compliment if you think about the magnitude of the git project and my
224 He explains his use of it [here][hiren].
226 [hiren]: https://caesr.uwaterloo.ca/wildrepos-in-gitolite/
228 **Gentoo Linux** has [just moved][gentoo1] their git repositories from gitosis
229 to gitolite. There are about 200 repositories, some of them are the so called
230 [overlays][gentoo2], official and unofficial/user overlays, plus several
231 developer and project repositories, used by more than 1000 people. That number
232 will be increased in the near future, as they are going to migrate some of
233 their CVS/SVN repositories there, plus they are offering overlays hosting for
236 [gentoo1]: https://archives.gentoo.org/gentoo-dev/msg_2812c9b9e768f64b46360ab17b9d0024.xml
237 [gentoo2]: https://www.gentoo.org/proj/en/overlays/
239 **kernel.org**, the official distribution point for the Linux kernel, is the
240 latest (as of 2011-10) high-visibility installation. According to [this
241 email][ko-ann] to the lkml, kernel.org decided to use gitolite for access
242 controlling their git repos. Their [FAQ entry][ko-why] describes at a high
243 level why they chose gitolite.
245 This move also prompted the first ever security audit of gitolite by an
246 outside party. Gitolite did great; see [here][audit] for details. [NOTE: v3
247 has not had such an audit yet; if you did one, please let me know what you
248 found. If you want to do one and need clarifications on anything or general
249 background let me know].
251 In addition, kernel.org was responsible for a serious rethink of a few rough
252 edges in gitolite, and smoothing them out was fun (the "playing with gitolite"
253 stuff, making the test suite simpler, "deny" rules for the entire repo).
255 [ko-ann]: https://lkml.org/lkml/2011/9/23/357
256 [ko-why]: https://www.kernel.org/category/faq.html#how-does-kernel-org-provide-its-users-access-to-the-git-trees
257 [audit]: https://groups.google.com/group/gitolite/browse_thread/thread/8dc5242052b16d0f
259 The **Mageia Project** is [using][mageia-gitweb] gitolite 3 to manage its
260 git repositories and access control. The repositories are [defined][mageia-def]
261 in yaml files. A tool called [mgagit][mgagit] has been created and is
262 repsonsible for the generation of the gitolite configuration from the
263 yaml repos definitions, and the extraction of users' ssh keys from an
264 ldap directory into the gitolite configuration.
266 Gitolite and mgagit are installed using rpm packages and
267 [a puppet module][mageia-puppet].
269 [mageia-gitweb]: https://gitweb.mageia.org/
270 [mageia-def]: https://gitweb.mageia.org/infrastructure/repositories/software/
271 [mgagit]: https://gitweb.mageia.org/software/infrastructure/mgagit/
272 [mageia-puppet]: https://svnweb.mageia.org/adm/puppet/deployment/mgagit/
276 A general note: if you see the list of high-profile users above, you will see
277 that gitolite benefits as much as they do; possibly more.
283 GIT is a trademark of Software Freedom Conservancy and my use of
284 "Gitolite" is under license.
287 [advanced]: advanced.html
288 [book]: https://www.packtpub.com/gitolite-essentials/book