Git is a version control system, which means that if we make any mistakes in the development of an application, we will always have the option to go back to a safe point where everything was working correctly. In this article, I will explain how to set up a git server on my preferred distro Gentoo using gitolite.
We will start with the installation of the software itself:
We add the git user:
The configuration of gitolite itself is done through a repository, in this step we are going to add the masterkey, which will be used to clone the config repo:
ssh-keygen -t rsa
cd ~
mkdir -p ~/bin
git clone git://github.com/sitaramc/gitolite
/var/lib/gitolite/gitolite/install -ln ~/bin
mkdir -p /var/lib/gitolite/.gitolite/logs
cd ~/bin
./gitolite setup -pk ../.ssh/MASTERKEY.pub
echo ’export PATH=/var/lib/gitolite/bin:$PATH’ » ~/.bash_profile
We start the service:
mkdir /var/git
/etc/init.d/git-daemon start
rc-update add git-daemon default
Git relies on ssh to transfer data, so we configure any ssh peculiarities such as changing the port…
Host localhost
HostName localhost
User git
Port 22
We clone the configuration repository:
We tell gitolite who we are:
git config –global user.name “kr0m”
Usually, git is not managed from the server itself, but administrative users are registered:
vi kr0m.pub
cd ..
cd conf
We add the user kr0m and remove the test repo.
repo gitolite-admin
RW+ = id_rsa kr0m
git add keydir/kr0m.pub
git add conf/gitolite.conf
git commit -m “added kr0m to gitolite-admin”
git push
Now we can clone the repo from the PC where kr0m’s key is located.
Host A.B.C.D
HostName A.B.C.D
Port 22
From now on, all administration will be done from this PC.
We add our repo:
vi conf/gitolite.conf
repo alfaexploit
RW+ = kr0m
git commit -m “added alfaexploit repo”
git push
We clone the new repository:
git clone git@A.B.C.D :/alfaexploit
This has been a brief introduction to gitolite and its configuration. In later articles, we will talk about git in more depth.