2016-04-26



About Gitolite

Gitolite is a free, open source Git server that can be used to setup git hosting on a central server, with fine-grained access control and many more powerful features. Gitolite is perfect if you want to host multiple git repositories in a single server. Gitolite is an access control layer on top of Git, so that, you can configure user-based Git access. Gitolite provides access to many gitolite users, and controls access to many Git repositories.

Here is the graphical overview of Gitolite:



Features in a glance

Concerning about Gitolite features, we can list the following:

Very powerful rule language (decide based on branch/tag name, files/dirs touched, size of changed files, number of changed files, etc.).

Convenience features for writing the rules (repo groups, user groups, get user group info from LDAP, include files, macros…)

Highly customisable and scriptable, especially custom commands for users. Many built-in commands and options.

Powerful and flexible mirroring system.

Users can create their own repos and set access rights (if you allow them).

In this tutorial, let us see how to install Gitolite Git server in CentOS 7 minimal server.

My test box details

For the purpose of this tutorial, I will be using the following testbox.

Operating system : CentOS 7 64 bit minimal server

IP address : 192.168.1.150/24

Hostname : server1.unixmen.local

Prerequisites

1. Update your server and install the prerequisites

Update your CentOS 7 server as root user using command:

Install the following prerequisites:

2. Create an user for Gitolite

Next, we create an user for Gitolite and set password for the users using the following commands:

3. Create SSH public key and copy it to the git user

We need to create a SSH public key and send it to the Gitolite server.

Create SSH key using command:

Sample output:



As you see in the above output, there are two keys are generated. One is private key, which you should keep it privately, and another one is public key. You should share this public key whoever you want to communicate with. In our case, we share this public key to the user ‘git’. Remember we have already created an user called ‘git’ in our previous steps.

First make a copy of your public key as shown below.

Now, let us copy the public key to the home directory of the user ‘git’ using the following command:

In case, you copying the this key from a remote system, you should the following command instead:

You can verify if the key is successfully transferred to the ‘git’ user’s home directory:

Run the following command to update the Bash:

We have completed all necessary prerequisites steps. Now, let us go ahead and install Gitolite.

Install Gitolite

Switch to the ‘git’ user with command:

Create a directory called bin in the ‘git’ user’s home directory.

To do so, run:

Now, git clone to the latest Gitolite repository as shown below.

Sample output:

Next, create Gitolite symlink to the ~/bin directory using command:

The above command will not display any message. You will see the Gitolite symbolic link in the ~/bin directory.

Finally, run the following command to install Gitolite with SSH public key:

Sample output:

If you get the output like above, Congratulations! Gitolite has been installed successfully.

You might see some warning. Just leave. They are normal in the new installation.

Test Gitolite

Now, let us test whether Gitolite is working properly. Switch to the account where you created the SSH keys. In my case, I created the SSH keys from my root account.

Try to git clone the gitolite-admin repository from your newly installed Gitolite server.

To do so, run:

You will be be asked to enter root user password. Because we already have exchanged the SSH keys.

Sample output:

Check the gitolite-admin repository contents with command:

That’s it. Gitolite is working!

We have just covered the installation part. Head over to the Gitolite basic administration guide to know more about the usage of Gitolite Git server.

Cheers!

Source & Reference links:

Gitolite homepage

Gitolite installation guide

The post How to install Gitolite in CentOS 7 appeared first on Unixmen.

Show more