minor stuff
[gitolite-doc.git] / rc.mkd
blob19558e4faf0c4ca2cb8020d01242854369840f10
1 <!-- options: toc -->
3 % the "rc" file (`$HOME/.gitolite.rc`)
5 include sidebar-toc
7 **IMPORTANT**: if you have a v3.0-v3.3 rc file it is documented [here][rc-33],
8 and it will still work.  Please see appendix A below for details.
10 @@gray(**If you're migrating from v2**, there are some settings that MUST be
11 dealt with **before** running `gitolite setup`; please read the
12 [migration][migr] page and linked pages, and especially the one on "presetting
13 the rc file".)@@
15 ----
17 @@box-r(Note: This page has several [forward references][fr]!)@@
19 The rc file is designed to be the only thing unique to your site for most
20 setups.
22 The rc file is well commented.  Please look at the `~/.gitolite.rc` file that
23 gets installed when you setup gitolite.  **You can always get a default copy
24 for your current version by running `gitolite print-default-rc`.**  (Please
25 see appendix A for upgrade instructions.)
27 # structure of the rc file
29 The rc file is perl code, but you do NOT need to know perl to edit it.  Just
30 mind the commas, use single quotes unless you know what you're doing, and make
31 sure the brackets and braces stay matched up!
33 As you can see there are 3 types of variables in it:
35   * A lot of simple variables (like `UMASK`, `GIT_CONFIG_KEYS`, etc.).
36   * A hash or two (like `ROLES`).
37   * And one large list of features to be enabled (`ENABLE`).
39 This page documents only some of them; for most of them it's best to look in
40 the actual rc file or in each of their individual documentation files around;
41 start with ["non-core" gitolite][non-core].  If a setting is used by a command
42 then running that command with '-h' may give you additional information.
44 # specific variables
46   * `$UMASK`, octal, default `0077`
48     The default UMASK that gitolite uses gives `rwx------` permissions to all
49     the repos and their contents.  People who want to run gitweb (or cgit,
50     redmine, etc) realise that this will not do.
52     The correct way to deal with this is to give this variable a value like
53     `0027` (note the syntax: the leading 0 is required), and then make the
54     user running the webserver (apache, www-data, whatever) a member of the
55     'git' group.
57     If you've already installed gitolite then existing files will have to be
58     fixed up manually (for a umask or 0027, that would be `chmod -R g+rX`).
59     This is because umask only affects permissions on newly created files, not
60     existing ones.
62   * `$GIT_CONFIG_KEYS`, string, default empty
64     @@box-r(See the [security note][privesc] at the end of this page for why we do
65     this.)@@
67     This setting allows the repo admin to define acceptable gitconfig keys.
69     Gitolite allows you to set git config values using the "config" keyword;
70     see [here][git-config] for details and syntax.
72     You have 3 choices.  By default `$GIT_CONFIG_KEYS` is left empty, which
73     completely disables this feature (meaning you cannot set git configs via
74     the repo config).
76     The second choice is to give it a space separated list of settings you
77     consider safe.  (These are actually treated as a set of [regular
78     expressions][regex], and any one of them must match).
80     For example:
82         $GIT_CONFIG_KEYS = 'core\.logAllRefUpdates core\..*compression';
84     Each regex should match the *whole* key (in other words, there
85     is an implicit `^` at the start of each regex, and a `$` at the
86     end).
88     The third choice (which you may have guessed already if you're familiar
89     with regular expressions) is to allow anything and everything:
90     `$GIT_CONFIG_KEYS = '.*';`
92   * `ROLES`, hash, default keys 'READERS' and 'WRITERS'
94     This specifies the role names allowed to be used by users running the
95     [perms][] command.  The [wild][] repos doc has more info on roles.
97   * `OWNER_ROLENAME`, string, default undef
99     (requires v3.5 or later)
101     By default, permissions on a wild repo can only be set by the *creator* of
102     the repo (using the [perms][] command).  But some sites want to allow
103     other people to do this as well.
105     To enable this behaviour, the server admin must first set this variable to
106     some string, say 'OWNERS'.  (He must also add 'OWNERS' to the ROLES hash
107     described in the previous bullet).
109     The creator of the repo can then add other users to the OWNERS role using
110     the [perms][] command.
112     The [perms][] command, the new "owns" command, and possibly other commands
113     in future, will then give these users the same privileges that they give
114     to the creator of the repo.
116     (Also see the full documentation on [roles][]).
118   * `LOCAL_CODE`, string
120     This is described in more detail [here][localcode].  Please be aware
121     **this must be a FULL path**, not a relative path.
123 # security note: gitolite admin and shell access {#privesc}
125 @@box-r(If you *must* revision control it, you can.  Just add it to your admin
126 repo, push the change, then replace `~/.gitolite.rc` with a symlink to
127 `~/.gitolite/.gitolite.rc`.)@@
129 People sometimes ask why this file is also not revision controlled.  Here's
130 why.
132 Gitolite maintains a clear distinction between
134 *   people who can push to the gitolite-admin repo, and
135 *   people who can get a shell or run arbitrary commands on the server.
137 This may not matter to many (small) sites, but in large installations, the
138 former is often a much larger set of people that you really don't want to give
139 shell access to.
141 Therefore, gitolite tries very hard to make sure that people in the first set
142 are not allowed to do anything that gets them into the second set.
144 # appendix A: upgrading the rc file
146 First, note that upgrading the rc file is always *optional*.  However, it may
147 help if you want to use any of the new features available in later gitolite
148 releases, in the sense that the lines you need to add may already be present
149 (commented out) in the rc file, so you just need to uncomment them instead of
150 typing them in yourself.
152 If you have a v3.0-v3.3 rc file it is documented [here][rc-33], and it will
153 still work.  In fact internally the v3.4 rc file data gets converted to the
154 v3.3 format.  There's a simple program to help you upgrade a v3.3 (or prior)
155 rc file (in @@gray(v3.6.1+)@@, see contrib/utils/rc-format-v3.4), but it has
156 probably not seen too much testing; please tread carefully and report any
157 problems you find.
159 Upgrading from any v3.4+ rc file to any later gitolite is fairly easy, though
160 still manual.  One useful aid is that, as of v3.6.4, you can run `gitolite
161 query-rc -d` to dump the entire rc structure to STDOUT.  **This only requires
162 that gitolite be v3.6.4+; your rc file can still be the old one.**  You can
163 use this to confirm you did not miss something during the manual rc upgrade.
165 *   dump the current rc by running `gitolite query-rc -d > old.dump` (assuming
166     you upgraded to v3.6.4 or higher)
168 *   save your old rc file: `mv ~/.gitolite.rc ~/old.gitolite.rc`
170 *   get a "default" rc for your current gitolite by running
172         gitolite print-default-rc > ~/.gitolite.rc
174 *   use your favourite diff-ing editor on the old and the new files and figure
175     out what to carry over from the old rc file to the new one.
177         vimdiff ~/old.gitolite.rc ~/.gitolite.rc
178         # or maybe kdiff3 or whatever
180     This is the tricky part of course!  Watch out for configs that got *moved*
181     around, or in some cases removed completely, not just new config items.
183 *   dump the new rc by running `gitolite query-rc -d > new.dump`
185 *   compare the 2 rc dumps to make sure you've got everything covered.