This guide shows you how to install and setup a Git Repository Server using Gitolite on Linux Ubuntu with Windows clients using MSysGit. It also includes how to use multiple SSH keys in 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.
Visit the official site for lots and lots of documentation: http://git-scm.com/
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. The essential magic in doing this is ssh’s pubkey access and the authorized_keys file, and the inspiration was an older program called gitosis.
Gitolite can restrict who can read from (clone/fetch) or write to (push) a repository. It can also restrict who can push to what branch or tag, which is very important in a corporate environment. Gitolite can be installed without requiring root permissions, and with no additional software than git itself and perl. It also has several other neat features described below and elsewhere in the doc/ directory.
I would recommend to read the documentation found on the official page: https://github.com/sitaramc/gitolite
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 Client
Start on your Server and create the gitolite admin account git:
On you Windows client in MSysGit create the SSH keys for the gitolite admin account git. If you haven’t installed MSysGit on your client read this guide first:
How to install and Setup GIT on Windows 7 using either MSysGit or Cygwin
~$ ssh-keygen -v -t rsa -C username@hostname
Note!: In this example I created the keys with the name git.
Copy your public key to the Server. The key should be in your /home/.ssh/ directory unless something have played with your path.
SSH to the Server and log in as root
Install the Git on the Server. The git-core contains all the basic commands for Git.
Log in as the gitolite admin user account:
Download to home dir:
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 from home dir:
~/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
Note!: If the bash can’t find gl-setup, be sure to add it to your path in your profile(.profile) – In my case I just had to log out and in, since the $PATH include was wrapped in a if clause.
Output ( too exit vi hit :q and enter ):
people but if you wish to make any changes, you can do so now.
Initialized empty Git repository in /home/git/repositories/gitolite-admin.git/
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