7 @@box-r(If you really, really, really want to manage gitolite directly on the
8 server, i.e., without cloning the gitolite-admin repo, you can -- [here's
9 how][server-side-admin]. This is likely to be of interest mainly to
10 puppet/chef type installations.)@@
12 Day-to-day management of a gitolite site is done by cloning the special
13 'gitolite-admin' repo, making appropriate changes to it, and pushing it back
14 to the server. The [concepts and terminology][concepts] page has a section
15 with some details on what happens after the push.
17 @@red(In other words, do **NOT** add new repos or users manually on the
20 # clone the gitolite-admin repo
22 To clone the admin repo, go to the workstation where the public key used in
23 'setup' came from, and run this:
25 git clone git@host:gitolite-admin
27 NOTE that (1) you must not include the `repositories/` part (gitolite handles
28 that internally), and (2) you may include the ".git" at the end but it is
31 If this step fails, be sure to look at the two pages linked from the [ssh][]
32 page before asking for help. (A very basic first step is to run `ssh git@host
33 info`; [this][info] page tells you what to expect).
35 # add/remove users {#users}
37 @@gray(NOTE: This section only applies to ssh mode. If you've installed
38 gitolite in http mode, adding and removing users is outside the scope of
41 Strictly speaking, gitolite doesn't know where users come from. (If that
42 surprises you, go back to the [concepts][] page and read the section on
43 "authentication and authorisation"). However, gitolite does help with
44 ssh-based authentication, by making it easy to add and remove users from
45 `~/.ssh/authorized_keys`.
47 To add or remove users, you have to clone the gitolite-admin repository, then
48 add or remove ssh pubkey files from the "keydir/" directory in the clone.
49 Then commit those changes and push.
51 Here's how to add users to gitolite. "alice" is the administrator and is
52 adding "bob" and "carol".
56 /-------------------\ /-----------------------\
57 | user "git" | | user "alice" |
58 | (on server) | | (on workstation) |
60 \-------------------/ \-----------------------/
61 /-------------------\ /-----------------------\
62 | (gitolite) |----------->| ~/gitolite‐admin |
66 \-------------------/ (3) \-----------------------/
68 /-----------------------\
69 /-------------------\ | (alice@workstation) |
70 | bob cYEL |----\ |~/gitolite‐admin/keydir|
71 | ~/.ssh/id_rsa.pub | | |cPNK |
72 \-------------------/ | +-----------------------+
74 /-------------------\ (2) +-----------------------+
75 | carol cYEL |----------->| carol.pub |
76 | ~/.ssh/id_rsa.pub | +-----------------------+
77 \-------------------/ | (...) |
78 \-----------------------/
84 All this is done from the admin (Alice)'s workstation. The steps are:
86 1. Run `git clone git@server:gitolite-admin`.
88 2. Obtain pubkeys from each user; email, USB, DHL, pigeon post, owl mail, any
91 Rename each received file to the name of the user, add a ".pub" at the
92 end, copy it into `keydir/` in the gitolite-admin repo you cloned.
94 3. Run `git add keydir`, then `git commit`, then `git push`.
96 You do NOT need to add Carol or Bob as *real* (Unix) users. You do NOT add
97 their keys directly anywhere on the server, and you most definitely do NOT
98 fiddle with the authorized\_keys file on the server directly!
100 To **remove** a user, `git rm keydir/alice.pub`.
102 Commit and push the changes. On receiving the push, gitolite will carry out
103 the changes specified.
105 **NOTE**: your users' public key is typically
106 `$HOME/.ssh/id_rsa.pub` on her workstation. Please make sure it is in
107 openssh's default format.
109 ## multiple keys per user {#multi-key}
111 You can put pubkeys in subdirectories within "keydir/", because the user name
112 is simply the *base name* of the public key file name. That is,
113 'keydir/alice.pub', 'keydir/home/alice.pub', 'keydir/laptop/alice.pub', (or
114 even 'keydir/work/desktop/alice.pub' -- any number of subdirectory levels are
115 OK) all resolve to user "alice".
117 This is the simplest and most understandable way to allow multiple keys per
120 ## old style multi-keys
122 <div style="color: gray">
124 There is another way that involves creating key files like `alice@home.pub`
125 and `alice@laptop.pub`, but there is a complication because gitolite also
126 allows *full email addresses* as user names. (I.e., `sitaramc@gmail.com.pub`
127 denotes the user called `sitaramc@gmail.com`).
129 This older method of enabling multi-keys was developed to deal with that. It
130 will continue to work and be supported in *code*, simply because I prefer it.
131 But I will not accept questions or doc patches for it, because it seems it is
132 too difficult to understand for a lot of people. This table of sample pubkey
133 filenames and the corresponding derived usernames is all you get:
135 * plain username, no multikey
137 sitaramc.pub sitaramc
139 * plain username, with multikeys
141 sitaramc@laptop.pub sitaramc
142 sitaramc@desktop.pub sitaramc
144 * email address as username, no multikey
146 sitaramc@gmail.com.pub sitaramc@gmail.com
148 * email address as username, with multikeys
150 sitaramc@gmail.com@laptop.pub sitaramc@gmail.com
151 sitaramc@gmail.com@desktop.pub sitaramc@gmail.com
155 # add, remove, and rename repos {#repos}
157 **NOTE**: this page describes how to add **new** repos. To bring already
158 existing repos under gitolite's control, click [here][existing].
160 To **add** a new repo, you have to clone the gitolite-admin repository, then
161 edit the [`conf/gitolite.conf`][conf] file. In that file, add the repo, along
162 with at least one user with some permissions.
166 You can add the new repo in its own paragraph:
179 You can also add it to an existing repo line, if the new repo is intended to
180 have the same access rules.
191 Commit and push the changes. Gitolite will create a bare, empty, repo on the
192 server that is ready to be cloned and pushed to.
198 As you can see, the "repo" line can have any number of repo names or repo
199 group names in it. However, it can only be one line; this will not work
205 repo bar # WRONG; 'foo' is now forgotten
213 If you have too many to fit on one line comfortably, you can create and use a
214 [repo group][groups]:
232 ## removing/renaming a repo
234 Removing a repo is not so straightforward. You certainly must remove the
235 appropriate lines from the `conf/gitolite.conf` file, but gitolite will not
236 automatically delete the repo from the server. You have to log on to the
237 server and do the dirty deed yourself :-)
239 It is best to make the change in the conf file, push it, and *then* go to the
240 server and do what you need to.
242 Renaming a repo is also not automatic. Here's what you do (and the order is
245 * Go to the server and rename the repo at the Unix command line. Don't
246 forget to retain the ".git" extension on the directory name.
247 * Change the name in the conf/gitolite.conf file in your gitolite-admin repo
248 clone, and add/commit/push.
250 # appendix 1: bringing existing repos into gitolite {#existing}
254 * Gitolite **will clobber** any existing `update` hook in your repos when
255 you do this. Please see either the [cookbook][] or the
256 [non-core][non-core] page for information on how to make your existing
257 update hook work with gitolite.
259 * Gitolite *may clobber* any existing "git-daemon-export-ok" file in your
260 repo; see the page on [allowing access to gitweb and
261 git-daemon][gitweb-daemon] for how to enable that via gitolite.
263 With that out of the way, here's how to do this:
265 First, on the server:
267 * Move the repos to `$HOME/repositories`.
271 * They are all *bare* repos.
272 * All the repo names end in ".git".
273 * All the files and directories are owned and writable by the gitolite
274 [hosting user][hu] (especially true if you copied them as root).
275 * There are no symbolic links left over from wherever the files were
278 * Run `gitolite setup`. **If you forget this step, you can also forget
279 about write access control!**
281 Then, back on your workstation:
283 * If the repos are normal repos, [add them][repos] to conf/gitolite.conf in
284 your clone of the admin repo, then commit and push the change.
286 If the repos are [wildcard][wild] repos that already match some repo regex
287 in the conf file, you need to manually create the gl-creator file, like
290 echo username > ~/repositories/path/to/repo.git/gl-creator
292 I haven't yet found this to be common enough to bother wrapping it in a
293 nice interface or command.