MMNCS.COM
  • Web
    • WordPress
    • Joomla
    • Drupal
  • Tips & Tricks
    • Youtube
    • WordPress
    • Windows
    • Web
    • Twitter
    • Linux Ubuntu
    • Google
    • Facebook
    • Drupal
    • Developer
    • Designer
    • Apple
  • Tech News
    • Windows Phone
    • Servers
    • Search Engines
    • Nokia
    • Microsoft
    • iPhone
    • Google
    • Facebook
    • Browsers
    • Apple
  • Social Media
    • Youtube
    • Yahoo
    • Twitter
    • Google+
    • Facebook
  • Server
    • Web Server
      • NGINX
      • Apache Web Server
    • Ubuntu
    • Security
      • Access Control
    • Mail Server
    • Hosting
    • FTP Server
    • Firewall
    • Database
      • MySQL
    • Backup
  • SEO
    • Yahoo Search
    • Google Search
    • Google AdSense
    • Bing
  • Off-Topic
    • Weird
    • Music
    • Fun
    • Documentaries
  • Mobile
    • Windows Phone 7
    • iPhone
    • Android
  • Google
    • Google Translate
    • Google Plus
    • Google PageRank
    • Google Adwords
    • AdSense
  • Design & Dev
    • Webdevelopment
    • Version Control
      • Git Version Control
    • Programming
    • PHP
    • JavaScript
    • HTML
    • Development Environment
    • CSS

Related

  1. How to setup an FTP Server with virtual users (no accounts) using VSFTPD on Linux Ubuntu 10.04 & 11.04 [ FTP Server Setup]
  2. How to install and Setup GIT on Windows 7 using either MSysGit or Cygwin – The fast Version Control System
  3. fatal: gitolite-admin.git does not appear to be a git repository
  • Share on Tumblr

How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 10.04 & 11.04 [Development Environment]

by MMNCS on July 11th, 2011, updated October 31, 2011
how to install and setup a git repository server on linux ubuntu 10.04 and 11.4 using gitolite the best distributed version control system

Git is the most hyped version control system at the moment and has been for some time now, but there is a reason for that. It’s fast, flexible, distributed (no network required), can communicate with Subversion, supports best development practices and the list goes on. We recommend using Git.
 
This guide shows how to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 10.04 and 11.04 Server and how to access the Server from a Linux client.
 
This setup has been tested on both Linux Ubuntu 10.04 and 11.04, and should also work on other Debian based distributions. It also includes how to setup a config file for multiple SSH key logins.
 

See also: How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu with Windows clients using MSysGit
 

Git is… a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

 

What is Gitolite? Gitolite lets you use a single user on a server to host many git repositories and provide access to many developers, without having to give them real userids on or shell access to the server.
 

Install Gitolite Repository Server
Start on your Server and create the gitolite admin account git. This is the account used to access all repositories from all clients:

~$ sudo adduser git

 

Create SSH keys for the git account
Go back to your local machine and open the bash to create the SSH keys for the git admin account.  

~$ ssh-keygen -t rsa

Note!: In this example we specified git as the user which means that there should be two files the private key named git and the public key named git.pub.

 

Copy your public key to the Server.
Use scp to copy the public key to the Server. This key is used when we install the Gitolite Server.

~$ scp ~/.ssh/git.pub git@hostname:git.pub

 

Login on the Server
SSH to the Server with the git account or another and then change the user to root. It is good practice to have deactivated root access to the Server!

~$ ssh git@hostname
~$ su

 

Install the Git on the Server
Start by installing Git on the Server by using the following command in the bash:

~$ sudo apt-get install git-core

 

Change to git user
When we setup Gitolite we do as the gitolite admin user account git.

~$ su - git

 

Download Gitolite
Download gitolite to your home directory by cloning it. This is done by the following command. The “gitolite-source” is the name given to the folder.

~$ git clone git://github.com/sitaramc/gitolite gitolite-source

 

Output:
Here is what you should see:

Initialized empty Git repository
in /home/git/gitolite-source/.git/ remote:
Counting objects: 3984, done. remote:
Compressing objects: 100% (1614/1614),
done. remote: Total 3984 (delta 2737),
reused 3405 (delta 2322) Receiving objects:
100% (3984/3984), 1.01 MiB | 752 KiB/s, done.
Resolving deltas: 100% (2737/2737), done.

 

Install gitolite
Installation is done by several bash scripts which mean that they might not be registered in your PATH. If the bash can’t find the command gl-setup script, be sure to add it to your PATH in your bash profile (.profile). In some cases you just have to change the user, since the $PATH include is loaded on user login. In the following commands we set the current directory to gitolite-source, create directories for Gitolite, run the bash scripts and in the end setup Gitolite with the public key created earlier on.

~$ cd gitolite-source/

~/gitolite-source $ mkdir -p ~/bin ~/share/gitolite/conf ~/share/gitolite/hooks

~/gitolite-source $ src/gl-system-install ~/bin ~/share/gitolite/conf ~/share/gitolite/hooks

~/gitolite-source $ cd ~

~$ gl-setup git.pub

 

Output
You should see the following output and the setup opens the gitolite configuration. Don’t change anything here if you don’t know what you are doing just hit :q and enter to exit.

The default settings in the rc file
(/home/git/.gitolite.rc) are fine for most
people but if you wish to make any changes,
you can do so now.

hit enter... creating gitolite-admin...
Initialized empty Git repository in
/home/git/repositories/gitolite-admin.git/
creating testing... Initialized empty Git repository in
/home/git/repositories/testing.git/ [master (root-commit) 028c1b6]
start 2 files changed, 6 insertions(+), 0 deletions(-)
create mode 100644 conf/gitolite.conf create mode 100644
keydir/git.pub

 

Remove the public key
Since we don’t want the public key laying around, we remove it from the home directory:

~$ rm -f git.pub

 

Setup SSH to only use public and private keys (Optional, but recommended)
This is done in the sshd_config file in /etc/ssh/sshd_config. Start by creating a backup and then open sshd_config file:

~ $ cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
~ $ nano /etc/ssh/sshd_config

 
 
Note!: Be sure to have a fall-back plan, so you don’t lock your self out! And remember to add the defaultuser to log in to your Server.
 
Here are the values to set. Defaultuser is the user you log in with SSH:

# This one is not important to git, but just recommended
PermitRootLogin no

AllowUsers git defaultuser
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no

 
If you want learn more about how to setup OpenSSH Server using keys you can read this: How to use Putty or MSysGit on Windows to login securely on Linux via OpenSSH with public and private key pairs

 

Apply the SSH settings
We need to reload the SSH Server before the settings are applied. This is done by the following command:

~$ /etc/init.d/ssh reload

 
How to use multiple SSH keys with different accounts
If you have different accounts and need mutiple SSH key logins you can specify which private keys to use. This i done by creating a config file in your $HOME/.ssh directory. Here is an example:

~/.ssh/config

host hostname
     user git
     hostname hostname
     port 22
     identityfile ~/.ssh/git

host hostname
     user defaultuser
     hostname hostname
     port 22
     identityfile ~/.ssh/id_rsa

See also: fatal: gitolite-admin.git does not appear to be a git repository

 

Administer Gitolite
Administering the Gitolite Repository Server is done by cloning the admin repository, editing the configuration files and then pushing the changes to the Server. This is always done on the client!

Clone the admin repo:

~$ git clone git@hostname:gitolite-admin

 
Now we have the gitolite-admin repository where we can add users and new repositories. Let’s start by adding a new user and then a new repository.

 
Add users
Here is an example on how to add a new user and a new repo.

First make the user create a public key and have them send it to you. Add the key to the gitolite-admin keydir: ~/gitolite-admin/keydir/new_repo_user.pub
 
Edit the gitolite configuration file ~/gitolite-admin/conf/gitolite.conf and add the new user to the new repository reponame:

repo gitolite-admin
                   RW+ = git

repo testing
                   RW+ = @all

repo reponame
                   RW+ = new_repo_user

 

Enable changes
First add and commit the new changes. Then push the changes to the Server:

~$ git add -A
~$ git commit -m "updated configuration"
~$ git push

 

Create Git repository
Now that we have created a new user and repository. We need to initialize a new project as a Git repository.

~$ cd /path/to/project
# initialize project
~$ git init
# add all files
~$ git add -A

 
Commit and push the changes to the Server

# initial commit with message
~$ git commit -m "Added files files to reponame"
# tell the repository where it should push changes
~$ git remote add origin git@hostname:reponame.git
# push the changes
~$ git push origin master

 

This is it. We recommend reading this article if you are just getting started with Git: A List of Useful & Common Git Commands Explained [Developer]
 

Add us to Facebook for more guides

Other ressources
Visit the official site for lots of documentation: http://git-scm.com/
 

We recommend reading the documentation found on the official page:
https://github.com/sitaramc/gitolite

You may be interested in

  1. How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 11.04 or 10.04 with Windows clients using MSysGit
  2. fatal: gitolite-admin.git does not appear to be a git repository
  3. How to install and setup php development environment using Eclipse, LAMP and xDebug on Linux Ubuntu 10.04 & 11.04 [Developer]
  4. How to install and Setup GIT on Windows 7 using either MSysGit or Cygwin – The fast Version Control System
  5. How to setup an FTP Server with virtual users (no accounts) using VSFTPD on Linux Ubuntu 10.04 & 11.04 [ FTP Server Setup]

support and subscribe to the site

Follow @mmncs
Posted in Development Environment, Git Version Control, Hosting, Programming, Server, Ubuntu, Version Control Tags: 2011, Apache Web Server, Configure, Dedicated Server, Distributed Version Control, Git Version Control, Gitolite, Guide, Install, msysgit, Online Learning, Server, Setup, SSH keys, VPS, windows
« How to Easy Backup Folders in Windows 7 using the Free Program SyncToy 2.1 from Microsoft [Tips & Tricks]
Howto add a Linux user account to the sudoers file on Linux Ubuntu 11.04 »


Comments

You can leave a response, or trackback from your own site.
  1. 2-8-2011
    Bert

    Installing on ubuntu server 11.04.

    On the final step:

    gl-setup git.pub gives the error:

    The program ‘gl-setup’ is currently not installed. To run ‘gl-setup’ please ask your administrator to install the package ‘gitolite’

    I solved this with: sudo apt-get install gitolite

    After this ‘gl-setup git.pub’ gave the error:

    fatal: empty ident not allowed

    This I fixed by including the name git for the git entry in /etc/passwd

    After this ‘gl-setup git.pub’ no longer gave any error.

    Reply
    • 3-8-2011
      mmncs

      Hi Bert,

      Thanks for the feedback. It is very appreciated when people take the time to comment, so other people who encounter the same problem.

      Regarding the error. Since I have used this guide many times as a reference. I am quite sure that the reason you got the error: The program ‘gl-setup’ is currently not installed. To run ‘gl-setup’ please ask your administrator to install the package ‘gitolite’ is because your bash hasn’t registered the gl-setup script. An easy way to do this, is to change to another user and then back again. Then the gl-setup should work.

      Best regards,

      Christian D. H.

      Reply
  2. 13-5-2012
    Zienek

    Hi.

    Now there is newer version of gitolite.
    “Install gitolite” section should be revised and updated.

    Thanks for this tutorial.

    Best regards,
    Zienek

    Reply
  3. 17-11-2012
    Damien

    On new gitolite, it is ‘gitolite setup’ instead of ‘gl-setup’.

    Reply

Leave a Reply

Click here to cancel reply.

Trackbacks & pingbacks

  1. 19-7-2011
    Install Setup Git Gitolite Repository Server Windows MSysGit | MMNCS says: [...] If you are using Linux Ubuntu or other Debian distributions use this guide instead: How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 11.04 Server and Cli... [...]
  2. 16-8-2011
    fatal: gitolite-admin.git does not appear to be a git repository | MMNCS.COM says: [...] also: How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 11.04 Server and Cli... See also: Useful Commen Git Commands #dd_ajax_float{ background:none repeat scroll 0 0 #ffffff; [...]
  3. 2-11-2011
    Introduction to Git | [a] Labs says: [...] Tutorial — How to install and setup a Git Repository Server using Gitolite [...]
  4. 2-11-2011
    Gitting into Git | [a] Labs says: [...] Tutorial — How to install and setup a Git Repository Server using Gitolite [...]

Search terms for this article

  • ubuntu y windows git lan,
  • gitolite config windows,
  • gitolite cygwin,
  • apache serve git,
  • ubuntu 10.04 install gitolite,
  • how to setup a web server on linux 11.04,
  • gitolite accessing from other linux client,
  • gitolite add remote,
  • git ubuntu server eclipse,
  • egit eclipse 11.04,
  • install+git+ubuntu+11.04+server+and+mac,
  • gitolite remove public key,
  • git server linux install,
  • configure server git linux,
  • how to install and setup a git repository gitolite,
  • how to install and configure git server on linux,
  • git server auf ubuntu root installieren,
  • iphone access git server,
  • synology repositories,
  • setup a public git server ubuntu,
  • ubuntu gitolite install 10.04,
  • how to configure web browser git server on ubuntu,
  • git plus ssh server setup,
  • git server windows recommendations,
  • gitolite for linux download,
  • instalar git debian cliente windows remoto,
  • gitolite repo for ubuntu,
  • git client without install,
  • gitolite apache set up,
  • install gitolite,
  • Subscribe

    Find MMNCS.COM on Facebook, about guides, tutorials and learning within webdevelopment, drupal, MySQL, PHP, WordPress, SEO...
    Follow MMNCS.COM on Twitter and get the latest updates
    Follow @mmncs
    Subscribe to MMNCS.COM newsletter, about guides, tutorials and learning within webdevelopment, drupal, MySQL, PHP, WordPress, Programming, Technology, SEO...
  • The Best technology news guides tips tricks on the Internet
  • best online art gallery, paintings, illustrations, fine art photography
  • Services

    Check your Google PageRank checker optimize seo serp page rank
    Take a picture of any website, WordPress Screenshot demo
  • Latest

    Facebook Helps Breakup on One-Third of Marriages in the U.K.

    Facebook Helps Breakup on One-Third of Marriages in the U.K.

    December 30th, 2011

    Husbands and wives in the United Kingdom headed for divorce are increasingly citing Facebook in thei[...]

    Nokia Lumia 800 Demo of Skyscanner. Flight Deals Search for Windows Phone

    Nokia Lumia 800 Demo of Skyscanner. Flight Deals Search for Windows Phone

    December 30th, 2011

    Here's another awesome application for the Nokia Lumia 800 and other Windows Phones. Skyscanner allo[...]

    Nokia Lumia, Samsung, HTC rumored to announce LTE Windows Phone smartphones at CES

    Nokia Lumia, Samsung, HTC rumored to announce LTE Windows Phone smartphones at CES

    December 29th, 2011

    Rumor has it that the one thing that is notoriously missing (well, one of the things) from any Wind[...]

    Why I’m Replacing My iPhone With Nokia Lumia 800 And Why Android Is No Option

    Why I’m Replacing My iPhone With Nokia Lumia 800 And Why Android Is No Option

    December 7th, 2011

    Spoiler alert: This article is about how great the new Nokia Lumia 800 is, so if you are an iPho[...]

    Apple iPhone 4S Battery Drain Is Starting To Become A Serious Issue [iOs 5]

    Apple iPhone 4S Battery Drain Is Starting To Become A Serious Issue [iOs 5]

    November 29th, 2011

    Waiting on the next expected fix from Apple, iPhone 4S users complaining of rapid battery drain are [...]

  • musicfordriving com music for driving underground experimental electronic electronica dj rock jazz upcomming interesting music hot list hype
  • Selected

    Bill Gurley; Too Many Start-Ups Chase Too Little Cash

    Bill Gurley; Too Many Start-Ups Chase Too Little Cash

    November 14th, 2011

    Venture capitalist Bill Gurley has noticed something new this autumn: a big jump in the number of wh[...]

    The Best Programming Contest Ever Made – The AI Challenge Ants 2011 [Developer]

    The Best Programming Contest Ever Made - The AI Challenge Ants 2011 [Developer]

    October 30th, 2011

    The best programming contest ever made! Well that is what they state. The AI Challenge Ants 2011 is [...]

    Take A Picture Of Any Website [WordPress Screenshot Demo]

    Take A Picture Of Any Website [WordPress Screenshot Demo]

    October 28th, 2011

    Take a picture of any website. Just enter the website address in the form and press the button "Take[...]

    Optimize Your Time And Write Better CSS With {less} – [CSS Stylesheets]

    Optimize Your Time And Write Better CSS With {less} - [CSS Stylesheets]

    October 23rd, 2011

    If you think parts of CSS is repetitive, tedious, and … well, very boring. Have a look here. LESS [...]

    Call Your Friends For Free –  Cut The Expensive Voice And Text Plans To The Bare Minimum [Mobile Apps]

    Call Your Friends For Free - Cut The Expensive Voice And Text Plans To The Bare Minimum [Mobile Apps]

    October 14th, 2011

    After been using Viber for some time now. We highly recommend this mobile application for all smartp[...]

  • News

    Facebook Helps Breakup on One-Third of Marriages in the U.K.

    Facebook Helps Breakup on One-Third of Marriages in the U.K.

    December 30th, 2011

    Husbands and wives in the United Kingdom headed for divorce[...]

    Nokia Lumia 800 Demo of Skyscanner. Flight Deals Search for Windows Phone

    Nokia Lumia 800 Demo of Skyscanner. Flight Deals Search for Windows Phone

    December 30th, 2011

    Here's another awesome application for the Nokia Lumia 800 and[...]

    Nokia Lumia, Samsung, HTC rumored to announce LTE Windows Phone smartphones at CES

    Nokia Lumia, Samsung, HTC rumored to announce LTE Windows Phone smartphones at CES

    December 29th, 2011

    Rumor has it that the one thing that is notoriously missing[...]

  • Social Media

    Solved: Facebook XFBML Like Button Bug Creates a Vertical Scroll-Bar [Web Developer]

    Solved: Facebook XFBML Like Button Bug Creates a Vertical Scroll-Bar [Web Developer]

    September 16th, 2011

    After been doing a lot of work on the site I noticed when testing in IE8 and Firefox 3.6.x that I wa[...]

    Add a Cool Google Plus Profile Add to Circles Widget to Your Website [Google Plus]

    Add a Cool Google Plus Profile Add to Circles Widget to Your Website [Google Plus]

    August 11th, 2011

    Google Plus has created a very simple widget to embed your Google Plus profile on websites. This wid[...]

    How To Export All Your Facebook Friends To Google+ Using Yahoo Mail [Google+]

    How To Export All Your Facebook Friends To Google+ Using Yahoo Mail [Google+]

    August 8th, 2011

    Since the popular Chrome extension Facebook Friends Exporter got blocked we needed another way of ge[...]

  • Google

    Check Your Google Page Rank Here – Updated To Use The New Google PageRank Query URL

    Check Your Google Page Rank Here - Updated To Use The New Google PageRank Query URL

    October 8th, 2011

    Check PAGE RANK of Web site pages Instantly This is a free service to check Google™ page rank ins[...]

    Add a Simple Google Translate DropDown Box To Your Web Site [Tips & Tricks]

    Add a Simple Google Translate DropDown Box To Your Web Site [Tips & Tricks]

    September 6th, 2011

    Google Translate is the best free online translation service today and I often wonder why I rarely s[...]

    Google Closes Down 10 Mayor Business Areas [Tech News]

    Google Closes Down 10 Mayor Business Areas [Tech News]

    September 5th, 2011

    Google closes down 10 business areas in which the company itself calls "autumn-cleaning."The cle[...]

  • Home
  • About
  • Contact
  • Wollawonka
Copyright © MMNCS.COM is a site aimed at web developers, system engineers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites. We cover Open Source recommendations, Linux Server guides, PHP, HTML, CSS, Drupal & WordPress Tutorials, Guides, Tips & Technology News.