Gitolite

Installation

Howto install gitolite3 from backports. Adding backports to your sources.list is described here.

The following steps are to be performed on the server where your repos will reside.

aptitude -t wheezy-backports install gitolite3

The home directory of gitolite3 in Debian is /var/lib/gitolite3.

Next, add your SSH pulic key to gitolite3 (the part that usually goes to the authorized_key file). This way you will become the admin of gitolite.

Setup publickey
You can do this in two ways:

# the Debian way:
dpkg-reconfigure gitolite3
 
# or the manual approach:
su gitolite
gl-setup /tmp/user.pub

Now you are done on the server. Move on to your workstation:

git clone gitolite3@server:gitolite-admin

All administration of gitolite will be done on your workstation, NOT on the server as gitolite!

Add users
To add users to gitolite you just need the pubkey of each user. Put the pubkey into keydir/johndoe.pub (.pub is required!), add the new pubkey, commit and push:

git add johndoe.pub
git commit -m "add johndoe pubkey"
git push origin

Add repos
Adding a repo is easy: edit conf/gitolite.conf:

gitolite.conf
repo    dotfiles
        RW+     = johndoe

Then you add, commit and push the change to gitolite as it was done before.

Your new repo will be created automagically the first time you push your first commits to it.

Messed up your install?

See “appendix b: cleaning out a botched install”
at http://gitolite.com/gitolite/g2/install.html

Access Control

Users

gitolite.conf
repo    dotfiles
        RW+     = johndoe janedoe
        RW      = ben
        R       = tim
  • R means “read” permission
  • RW means “read and write”, but no rewind
  • RW+ means “read and write”, with rewind allowed

A “rewind” means “non-fast forward push”

Use groups

gitolite.conf
@group1   = ben tim

repo workbench
        RW      = @group1

See all the details here: http://sitaramc.github.com/gitolite/bac.html

Move a pre-existing Repo into Gitolite

  1. create a fresh empty repo with gitolite as described above
  2. move into your clone on your workstation
  3. run these commands:
    git push --all gitolite3@server:reponame
    git push --tags gitolite3@server:reponame
  4. done → you can clone now from gitolite :-)

Rename a Repository

To rename a repository that already exists do the following (in this order, do not revese):

  1. log into the server cd $REPO_BASE (default: /var/lib/gitolite3/repositories)
  2. move oldname.git newname.git
  3. on your workstation, on the gitolite-admin clone edit conf/gitolite.conf
  4. replace all occurences of oldname with newname
  5. add, commit and push
  6. done :)

Move a Repository to a New Server

Imagine you have to move your repo to a new server. This is how to do it:

mkdir tmp && cd tmp
git clone --mirror gitolite@old.server:repo-name
cd repo-name
git remote set-url origin gitolite3@new.server:repo-name
git remote -v
git push --mirror

In every clone you have to change the origin to the new server:

git remote set-url origin gitolite3@new.server:repo-name

To make a new clone everything is straight forward:

git clone gitolite3@new.server:repo-name
,
howto/git/gitolite.txt · Last modified: 2015-08 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready