Much of gitolite's functionality comes from programs and scripts that are not considered "core". This keeps the core simpler, and allows you to enhance gitolite for your own site without too much fuss.

Documentation for non-core gitolite is organised as follows:

1 core versus non-core

Gitolite has five types of non-core code:

2 locations...

2.1 ...for non-core programs shipped with gitolite

gitolite query-rc GL_BINDIR will tell you where gitolite's code has been installed. That directory should look like this. Among these, the directories in green are considered "non-core", while the ones in red are considered "core". In addition, the two files "gitolite" and "gitolite-shell" in src are also considered "core"

You might notice that there are two locations for triggers; that is simply because there are two types of them. You might also notice that there is no place for hooks -- gitolite doesn't ship with any hooks that are non-core.

├── commands
├── lib
│   └── Gitolite
│       ├── Conf
│       ├── Hooks
│       ├── Test
│       └── Triggers
├── syntactic-sugar
├── triggers
└── VREF

2.2 ...for your non-core programs

If you want to add your own non-core programs, or even override the shipped ones with your own, you can.

Put your programs in some convenient directory and use the LOCAL_CODE rc variable to tell gitolite where that is. Please supply the FULL path to this variable. (You'll find the rc file already has examples lines, commented out, so it's easy to know where to put it and what syntax to use).

Within that directory, you can use any or all of the subdirectories shown here.

If you add a program in your local code directory with the same name as a shipped program, gitolite uses your version.

Notice that there are two directories related to hooks here, neither of which exist in the shipped non-core code. Also, the hooks/common directory is a bit special. If you add new hooks to this, you must run gitolite setup, or at least gitolite setup --hooks-only.

├── commands
├── hooks
│   └── common
│   └── repo-specific
├── lib
│   └── Gitolite
│       └── Triggers
├── syntactic-sugar
├── triggers
└── VREF

2.3 using the gitolite-admin repo to manage non-core code


In this mode, anyone who can push changes to the admin repo will effectively be able to run any arbitrary command on the server. See gitolite admin and shell access for more background.

The location given in LOCAL_CODE could be anywhere on disk, like say $ENV{HOME}/local.

However, some administrators find it convenient to use the admin repo to manage this code as well, getting the benefits of versioning them as well as making changes to them without having to log on to the server.

To do this, simply point LOCAL_CODE to someplace inside $GL_ADMIN_BASE in the rc file. I strongly suggest:

LOCAL_CODE  =>  "$rc{GL_ADMIN_BASE}/local",

Then you create a directory called "local" in your gitolite clone, and create the directory structure (shown in the previous section) within that directory. Thus, when you push the admin repo, the files will land up, with the correct paths, in the location pointed to by LOCAL_CODE.

(Note: when you do this, gitolite takes care of running gitolite setup --hooks-only when you change any hooks and push).

3 types of non-core programs

3.1 gitolite "commands"

Gitolite comes with several commands that users can run. Remote users run commands by saying:

ssh git@host command-name [args...]

while on the server you can run

gitolite command [args...]

Very few commands are designed to be run both ways, but it can be done, by checking for the presence of env var GL_USER.

All commands respond to a single -h option with a suitable message.

You can get a list of available commands by using the help command. Naturally, a remote user will see a much smaller list than the server user.

You allow a command to be run from remote clients by adding its name to (or uncommenting it if it's already added but commented out) the ENABLE list in the rc file.

3.2 hooks and gitolite

You can install any hooks except these:

How/where to install them is described in detail in the "locations" section above, especially this and this. The summary is that you put them in the "hooks/common" sub-directory within the directory whose name is given in the LOCAL_CODE rc variable, then run gitolite setup.

3.2.1 repo-specific hooks

WARNING: If your site makes a distinction between "right to push the admin repo" and "right to run arbitrary commands on the server" (i.e., if not all of your "admins" have shell access to the server), this is a security risk. If that is the case, do not enable this feature.

If you want to add hooks only to specific repos, you can just do it manually if you wish -- just log on to the server and add hooks (except update hook and, for the special gitolite-admin repo, the post-update hook -- touch these and all bets on gitolite's functionality are off).

However, if you want to do that from within gitolite, and thus keep everything together, you can do that also. Here's how.

3.3 syntactic sugar

Sugar scripts help you change the perceived syntax of the conf language. The base syntax of the language is very simple, so sugar scripts take something else and convert it into that.

That way, the admin sees additional features (like allowing continuation lines), while the parser in the core gitolite engine does not change.

If you want to write your own sugar scripts, please read the "your own sugar" section in dev-notes first then email me.

You enable a sugar script by uncommenting the feature name in the ENABLE list in the rc file.

3.4 triggers

Triggers have their own page.

3.5 VREFs

VREFs also have their own page.