Sunday, November 6, 2011

How to setup your own Git Server using Gitolite?

Gitolite's documentation is very well written and informational. Below are basically a step by step version of it.

1. Create a Gitolite user on the server: This is the account of which Gitolite will perform git commands on the server. The users will be interacting with this account using the SSH Server. Please be sure SSH daemon is installed and configured on the server.

2. Install Git on server: Download and install the binary from git. To make life easier please copy git to "/usr/bin/" for later installation usage.
sudo cp /usr/local/git/bin/git /usr/bin/

3. SSH Public key: Generate & copy your public key to the server. It is suggested to re-name your public key on the server to $YourPublicKey = that way it can be easily identify in the future.
scp $YourPublicKey gitolite@gitserver:$YourPublicKey
ssh-copy-id -i $YourPublicKey gitolite@gitserver
4. SSH to Server: Login to server
ssh gitolite@gitserver
5. Clone Gitolite:
git clone git://
6. Install Gitolite:Make sure "setenv PATH $PATH\:/Users/docchang/bin" is in your .cshrc or equivalent.
7. Install your public key:
./gitolite/src/gl-setup $YourPublicKey
8. Your will be prompt to edit .gitolite.rc: Insert the absolute Git path to $GIT_PATH

There is a difference with Git

Differences between Git and other source controls
  • De-centralized: Connection to the central repository is not necessary. In the world of Git there is no discrimination against a clone repository vs the main repository. Every repository is independently operated. You can branch as many times as you needed, merge it and push it back to the main repository.  
  • Staging Phase: An option that gives you the flexibility to mark which files or portions of a file to commit.

Let's make a difference with Git.