5 <span class="green box-r">If you really, really, really want to manage
6 gitolite directly on the server, i.e., without cloning the gitolite-admin
7 repo, you can -- [here's how][ssa]. This is likely to be of interest mainly
8 to puppet/chef type installations.</span>
10 [ssa]: odds-and-ends#administering-gitolite-directly-on-the-server
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 <span class="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](ssh)
32 page before asking for help. A very basic first step is to run the `info`
33 command (`ssh git@host info`); [this][info] page tells you what to expect.
35 [info]: user#the-info-command
39 <span class="gray">NOTE: This section only applies to ssh mode. If you've installed
40 gitolite in http mode, adding and removing users is outside the scope of
43 Strictly speaking, gitolite doesn't know where users come from. (If that
44 surprises you, go back to the [concepts](concepts) page and read the section on
45 "authentication and authorisation"). However, gitolite does help with
46 ssh-based authentication, by making it easy to add and remove users from
47 `~/.ssh/authorized_keys`.
49 To add or remove users, you have to clone the gitolite-admin repository, then
50 add or remove ssh pubkey files from the "keydir/" directory in the clone.
51 Then commit those changes and push.
53 Here's how to add users to gitolite. "alice" is the administrator and is
54 adding "bob" and "carol".
58 All this is done from the admin (Alice)'s workstation. The steps are:
60 1. Run `git clone git@server:gitolite-admin`.
62 2. Obtain pubkeys from each user; email, USB, DHL, pigeon post, owl mail, any
65 Rename each received file to the name of the user, add a ".pub" at the
66 end, copy it into `keydir/` in the gitolite-admin repo you cloned.
68 3. Run `git add keydir`, then `git commit`, then `git push`.
70 You do NOT need to add Carol or Bob as *real* (Unix) users. You do NOT add
71 their keys directly anywhere on the server, and you most definitely do NOT
72 fiddle with the authorized\_keys file on the server directly!
74 To **remove** a user, `git rm keydir/alice.pub`.
76 Commit and push the changes. On receiving the push, gitolite will carry out
77 the changes specified.
79 **NOTE**: your users' public key is typically
80 `$HOME/.ssh/id_rsa.pub` on her workstation. Please make sure it is in
81 openssh's default format.
83 ## multiple keys per user
85 You can put pubkeys in subdirectories within "keydir/", because the user name
86 is simply the *base name* of the public key file name. That is,
87 'keydir/alice.pub', 'keydir/home/alice.pub', 'keydir/laptop/alice.pub', (or
88 even 'keydir/work/desktop/alice.pub' -- any number of subdirectory levels are
89 OK) all resolve to user "alice".
91 This is the simplest and most understandable way to allow multiple keys per
94 Please see appendix 2 at the bottom of this document for an older way that
95 will continue to be supported but has proved hard to explain!
97 (Finally, if you *insist* on wanting to actually put all the keys for a user
98 into a single, multi-line, pubkey file, it is possible. For details, see the
99 program `src/triggers/post-compile/ssh-authkeys-split` in the source.)
101 # add, remove, and rename repos
103 [existing]: basic-admin#appendix-1-bringing-existing-repos-into-gitolite
107 Note: this page describes how to add **new** repos. To bring already
108 existing repos under gitolite's control, click [here][existing].
110 To **add** a new repo, you have to clone the gitolite-admin repository, then
111 edit the [`conf/gitolite.conf`](conf) file. In that file, add the repo, along
112 with at least one user with some permissions.
114 You can add the new repo in its own paragraph,
121 or you can add it to an existing repo line, if the new repo is intended to
122 have the same access rules:
129 Either way, commit and push the changes. Gitolite will create a bare, empty,
130 repo on the server that is ready to be cloned and pushed to.
134 As you can see, the "repo" line can have any number of repo names or repo
135 group names in it. However, it can only be one line; this will not work:
139 repo bar # WRONG; 'foo' is now forgotten
143 If you have too many to fit on one line comfortably, you can create and use a
144 [repo group][groups]:
146 [groups]: conf#group-definitions
160 ## removing/renaming a repo
162 Removing a repo is not so straightforward. You certainly must remove the
163 appropriate lines from the `conf/gitolite.conf` file, but gitolite will not
164 automatically delete the repo from the server. You have to log on to the
165 server and do the dirty deed yourself :-)
167 It is best to make the change in the conf file, push it, and *then* go to the
168 server and do what you need to.
170 Renaming a repo is also not automatic. Here's what you do (and the order is
173 * Go to the server and rename the repo at the Unix command line. Don't
174 forget to retain the ".git" extension on the directory name.
175 * Change the name in the conf/gitolite.conf file in your gitolite-admin repo
176 clone, and add/commit/push.
178 # appendix 1: bringing existing repos into gitolite
180 !!! danger "Warning!"
182 Gitolite **will clobber** any existing `update` hook in your repos when
183 you do this. Please see either the [cookbook](cookbook) or the [non-core](non-core) page
184 for information on how to make your existing update hook work with
187 Gitolite *may clobber* any existing "git-daemon-export-ok" file in your
188 repo; see the page on [allowing access to gitweb and
189 git-daemon](gitweb-daemon) for how to enable that via gitolite.
191 With that out of the way, here's how to do this:
193 !!! danger "Warning!"
195 This warning applies to versions before v3.6.10.
197 Depending on how your gitolite.conf is setup, and how much time you take
198 between moving the repositories and completing the rest of the
199 instructions below, it may be possible for a user to read or write the
200 repos you are in the process of migrating.
202 To prevent writing, you can [disable write access][dw] to all repos before
203 you start this process. Preventing reading is much harder, but at the
204 same time, most configurations will not have this problem. If in doubt,
205 ask on the mailing list.
207 Either way, don't forget to re-enable access at the end of this process!
209 [dr]: conf-2#read-access-respecting-deny-rules
211 First, on the server:
213 * Move the repos to `$HOME/repositories`.
217 * They are all *bare* repos.
218 * All the repo names end in ".git".
219 * All the files and directories are owned and writable by the gitolite
220 [hosting user][hu] (especially true if you copied them as root).
221 * There are no symbolic links left over from wherever the files were
224 * Run the following three commands:
227 gitolite setup --hooks-only
228 gitolite trigger POST_COMPILE
230 * If the repos are [wildcard](wild) repos that already match some repo regex
231 in the conf file, you need to manually create the gl-creator file, like
234 echo username > ~/repositories/path/to/repo.git/gl-creator
236 I haven't yet found this to be common enough to bother wrapping it in a
237 nice interface or command.
239 [hu]: concepts#the-hosting-user
240 [dw]: odds-and-ends#disabling-pushes-to-take-backups
242 However, if the repos are normal repos, then, back on your workstation:
244 * Add them to the `conf/gitolite.conf` in your clone of the admin repo, then
245 commit and push the change.
247 # appendix 2: old style multi-keys
249 There is another way that involves creating key files like `alice@home.pub`
250 and `alice@laptop.pub`, but there is a complication because gitolite also
251 allows *full email addresses* as user names. (i.e., `sitaramc@gmail.com.pub`
252 denotes the user called `sitaramc@gmail.com`).
254 This older method of enabling multi-keys was developed to deal with that. It
255 will continue to work and be supported in *code*, simply because I prefer it.
256 But I will not accept questions or doc patches for it, because it seems it is
257 too difficult to understand for a lot of people. This table of sample pubkey
258 filenames and the corresponding derived usernames is all you get:
260 * plain username, no multikey
262 sitaramc.pub sitaramc
264 * plain username, with multikeys
266 sitaramc@laptop.pub sitaramc
267 sitaramc@desktop.pub sitaramc
269 * email address as username, no multikey
271 sitaramc@gmail.com.pub sitaramc@gmail.com
273 * email address as username, with multikeys
275 sitaramc@gmail.com@laptop.pub sitaramc@gmail.com
276 sitaramc@gmail.com@desktop.pub sitaramc@gmail.com