At the end of this process, you will have a version of Gitolite all set up and ready to use. You will also have an "admin" user, and six "normal" users, using which you can try out most of the features of Gitolite (with the exception of some advanced features such as mirroring).
You will need the following in order to try out Gitolite:
A Unix (Linux, BSD, HP-UX, AIX, Solaris, and so on) server
Git version 1.7.1 or later installed on the server
Perl 5.8.8 or later version installed on the server
An OpenSSH-compatible SSH daemon installed and running on the server
Root access to the server in order to create a new throw away user to do the testing in
At the time of writing this book, Git 1.7.1 is over three years old, and Perl 5.8.8 is quite a bit older than that, so almost any recent Linux or BSD system should work fine.
Installing and setting up a test instance
With the prerequisites at hand, here's how you would get yourself a test
instance of Gitolite to try out:
Log in as root (using whatever commands your OS/distro requires to do that) and create a new throw away user. You can call this anything you want, but we will use the name gitolite-test
here. Please do not use an existing user for this!
Log in as the gitolite-test
user.
Get the Gitolite sources from the official repository, git clone
git://github.com/gitolite/gitolite
.
You can get this from any other clone of the gitolite sources if your server cannot directly access the internet. Just substitute the URL you have in the preceding clone
command.
Switch to the directory that was just cloned using the following command:
Install and set up Gitolite in test mode using the following command:
Go back to the HOME directory:
This will churn through two of the test scripts. You will see a warning about an authorized_keys
file being created, which you can ignore, and finally a message saying All tests successful
, with some statistics on the test run.
At the end of that process, you should have the following: one "admin" user (called admin
) and six normal users (named u1
through u6
). These users are simulated using an ssh
feature. If you are familiar with ssh
, you can look in ~/.ssh/config
to see how this is done.
You can now use the test setup of gitolite from the previous section. Here's a sample set of commands with notes to start you off:
Clone the special gitolite-admin
repository:
Examine the contents of the clone:
Edit the conf/gitolite.conf
file and add the following lines, which tell Gitolite to create a new repository called bar
and allow users u1
and u2
all rights to it:
Save the file, then add the change (git add
) and commit the file (git commit
):
As you can see, we've just created a new repository called bar
. If you look at the output carefully, you might notice, among the familiar output of a git push
command, a line saying that an empty Git repository was initialized on the server. This is useful because you don't have to log on to the server to create the repository—Gitolite takes care of it.
Let's look at some access rights. Running ssh against the server and supplying info
as the command will show you what repositories you have access to:
The preceding command shows you a list of the repositories you have access to, and for each of them, whether you can read and write to the repository, or you have read-only access.
Tip
A note on command and URL syntax
Remember that we are running the Gitolite server, as well as simulating the seven different users, on the same Unix user (which is gitolite-test
). As a result, you are able to use commands such as git clone admin:gitolite-admin
and ssh u1
info. In a real setup, you will represent yourself, and the server will be elsewhere. The commands will be of the form git clone gitolite-test@server:gitolite-admin
and ssh gitolite-test@server info
.