This tutorial will show you how to easily and conveniently setup git repositories with Gitolite on Debian Wheezy. For the course of this tutorial, we will assume that you are working with administrative privileges. If you want to use
sudo instead, append it where necessary.
First, login via SSH and make sure that your packages are up to date and that the dependencies are met:
apt-get update && apt-get upgrade && apt-get install git perl
Gitolite depends on a dedicated user for everything git-related, since it acts as a wrapper around it. You can name it whatever you want. We'll go with
useradd -m git passwd git
Make sure that your own SSH public key has been copied on the server by issuing the following command from your client machine:
scp yourkey.pub firstname.lastname@example.org:˜/yourname.pub
This only works for Linux or BSD workstations. For Windows and OS X, please consult the documentation of your operating system. If you don't have SSH keys right now, see this Vultr doc on how to generate them.
The next step is important. Ensure that your
˜/.ssh/authorized_keys file is empty.
Download and install
Gitolite directly from Github since the version in Debian's repository is outdated:
su git cd git clone git://github.com/sitaramc/gitolite mkdir -p $HOME/bin gitolite/install -to $HOME/bin
Make yourself an administrative user:
bin/gitolite setup -pk yourname.pub
The installation is complete. Next, you need to add users and repositories. Contrary to "normal" systems management, Gitolite relies on a special repository for user and repository management, it's called
gitolite-admin on your client:
git clone email@example.com:gitolite-admin
gitolite-admin, you should now see two directories:
keydir stores the public keys of users, therefore if you wanted to add a user called
user1, you would place their public key in the
keydir and name it
Adding new repositories is done in the file
conf/gitolite.conf. To give
user1 read and write access to the repository
Testing (which is already there by default) you would have to change it to the following:
repo testing 5 RW+ = user1
To make those changes take effect, you have to push the changes to the repository:
git add conf git add keydir git commit -m "user1 - testing" git push
That's about everything - repeat the process for every new user / repository. Happy coding!