% idiot-proof setup for gitolite
If I gave you this link to read, it most likely means either:
- (most common reason) You got really confused by [ssh].
- (a bit less common) You got confused by how to administer users and repos using gitolite.
Don't take the title personally. The "idiot" in the title is indeed a real person who once bugged me so much I wrote this for him. However, I have since realised that this is also useful for (a) people for whom English is not the first language and (b) people who really should not be doing technical work at this level, but are forced to do it by circumstances.
These are the pre-requisites:
- Any Linux machine on which git has already been installed.
- Probably any BSD or legacy system like Solaris will also work, but I have
not tested them.
- I do not consider Apple devices to be Unix enough; it should work, but please do not ask me for help if it does not.
This page has several restrictions and constraints that seem unnecessary to people who do understand ssh. That's the whole point -- I'm compensating for lack of ssh knowledge by removing things that trip people up.
If even this page does not help you install gitolite, I probably cannot help you. Either you did not follow the instructions carefully (maybe some task has to be run on your workstation, but you ran it on the server, or you ran something as root when it should be as the hosting user, etc.), or your environment is far too different from standard Unix, or you have some other problem. In any case, it is not something I can help with. Sorry.
Your name is Ron. Substitute accordingly in the instructions below.
You have a workstation.
You have a server called
You have root access on this server.
Create a new userid on the server, say
git. This will be the hosting user. ("hosting user" means when you're done installing, your users will use URLs like
Make sure this is a NEW userid.
If the name you want already exists, then:
- Log in as root.
- If you have any data on that user's HOME directory save it somewhere else.
- Delete the userid.
- Completely wipe out (erase) the home directory of the user (since on most systems merely deleting the user does not remove the home directory).
- Re-create the userid again.
If you don't already have one, make yourself an ssh keypair on your workstation.
Do NOT add this public key to the authorised keys file on the newly created hosting user!
Your ONLY access to the new (
git) userid should be by logging onto the server as root, then running
su - git.
Now copy the pubkey from your workstation (
~/.ssh/id_rsa.pub) to the server as
/tmp/ron.pub. (Your name is Ron, remember?)
Log on to the server as root.
Switch to the
su - git
Clone the gitolite source code
git clone git://github.com/sitaramc/gitolite
cd $HOME mkdir -p bin gitolite/install -to $HOME/bin
Set it up
cd $HOME $HOME/bin/gitolite setup -pk /tmp/ron.pub
Now go to your workstation and type in
git ls-remote git@server:gitolite-admin
This should return something like
9dd8aab60bac5e54ccf887a87b4f3d35c96b05e4 HEAD 9dd8aab60bac5e54ccf887a87b4f3d35c96b05e4 refs/heads/master
(do I have to mention that your SHAs will be different?)
Most day-to-day administration is done by making changes to a clone of the
gitolite-admin repo and pushing. (There are some things that are done by
$HOME/.gitolite.rc on the server, but those are too advanced for
this tutorial so we will ignore that).
To start administering gitolite, clone the gitolite-admin repo:
git clone git@server:gitolite-admin
Now go to the new directory this creates, and look around:
cd gitolite-admin ls -A
which gives you
conf/ .git/ keydir/
Ignoring the ".git" and exploring further:
ls -A conf keydir
conf: gitolite.conf keydir: ron.pub
Let's say you want to add your colleague Alice. She has sent you her ssh public key by email (the file is called
id_rsa.pub). Save this file as /tmp/alice.pub, then do this:
# still in your gitolite-admin clone, from the previous step cp /tmp/alice.pub keydir git add keydir git commit -m 'new user alice' git push
Well, that might not be sufficient. There aren't any new repos for alice to play with, yet. So here's what you do: edit "conf/gitolite.conf" and add something like to the end:
repo foo RW+ = alice R = ron
Save the file, then
git add conf; git commit -m 'new repo foo'; git push.
This will automatically the brand new repo called "foo" on the server, and alice will be able to clone from it, or push anything to it.