Gitolite administration instructions:

Title:Gitolite administration instructions:
Author:Douglas O’Leary <>
Description:Gitolite administration instructions:
Date created:02/2015
Date updated:02/2015
Disclaimer:Standard: Use the information that follows at your own risk. If you screw up a system, don’t blame it on me...


  • Create git user, configure its environment - including ${HOME}/bin

  • As git user: git clone git://

  • gitolite/install --to ${HOME}/bin

  • Copy admin’s ssh key to system as ${user}.pub, then as git, execute: gitolite setup -pk ${key}

  • From the host where the private key is:

    $ ssh git@mgmt2 info
    hello dkoleary, this is git@mgmt2 running gitolite3 v3.6.2-20-g78fc240 on git 1.7.1
     R W    gitolite-admin
     R W    testing
  • Clone the gitolite-admin repo, then configure additional users/repos as needed.


  • Clone the gitolite-admin repo:

    $ git clone git@mgmt2:gitolite-admin ./mgmt2-gitolite-admin
    Initialized empty Git repository in /ignite/dkoleary/mpi_git/mgmt2-gitolite-admin/.git/
    remote: Counting objects: 6, done.
    remote: Compressing objects: 100% (4/4), done.
    remote: Total 6 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (6/6), done.
  • Copy any/all required keys to keydir in the newly cloned local repo

    • cp mgmt1-gitolite-admin/keydir/* mgmt2-gitolite-admin/keydir
    • cd mgmt2; git add -A && git commit -am'new keys'
    • git push
  • If not doing mirroring, configure and/or migrate private/public repos as needed.


  • Uncomment/Update HOSTNAME parameter in ~git/.gitolite.rc file. HOSTNAME doesn’t have to be the host name but does have to be unique. Once done, compile.

    $ grep HOSTNAME .gitolite.rc | grep -v '#'
    HOSTNAME                  =>  "mgmt2",
    $ gitolite compile
  • Update ssh environment:

    • On new mirror, create a null passphrased default key:

      $ ssh-keygen -t dsa -P ""
      Generating public/private dsa key pair.
      Enter file in which to save the key (/home/git/.ssh/id_dsa):
      Your identification has been saved in /home/git/.ssh/id_dsa.
      Your public key has been saved in /home/git/.ssh/
    • Copy newly created id_[rd] to gitolite-admin repos in the keydir directory. Resulting filename should be server-${HOSTNAME} as defined aabove. Add/commit/push

    • Create ssh aliases using the hostnames as defined in ~git/.gitolite.rc:

      host mgmt1
          hostname mgmt1
          user git
          ForwardX11 no
      host mgmt3
          hostname mgmt3
          user git
          ForwardX11 no
      host mgmt2
          hostname mgmt2
          user git
          ForwardX11 no
    • Verify ssh ${gitsvr} info works from all hosts to all hosts.

      $ ssh mgmt1 info
      hello server-mgmt2, this is git@mgmt1 running gitolite3 v3.6.2-4-g2471e18 on git 1.7.1
           C  private/CREATOR/..*
  • Enable/configure mirroring:

    • On each node,

      • edit ~git/.gitlote.rc. Uncomment ‘Mirroring’ line on/about line 144.
      • Execute gitolite compile as the git user
    • In gitolite master (mgmt1) repo, config directory, update mirroring to relfect the new system:

      cd ${mpigit}/mgmt1-gitolite-admin/conf
      repo root/scripts
          RW+  = @admins
          RW+  = @san
          option mirror.master     = mgmt1
          option mirror.slaves     = mgmt3 mgmt2
          option mirror.redirectOK = all
      git commit/push
    • In the new slave (mgmt2 in this case) gitolite-admin repo, update the config to reflect mirroring:

      git clone git@mgmt2:gitolite-admin ./mgmt2-gitolite-admin
      cd mgmt2-gitolite-admin/conf
      repo root/scripts
          RW+  = @admins
          RW+  = @san
          option mirror.master     = mgmt1
          option mirror.slaves     = mgmt3 mgmt2
          option mirror.redirectOK = all
      git commit/push
    • Repull the newly mirrored gitolite-admin repo. If it’s not mirrored, log into git@mgmt1 and execute:

      gitolite mirror push ${server} gitolite-admin
    • Push the other mirrored repos to the new slave. Access git@mgmt1 then:

      cd .gitolite/conf
      for d in $(grep ^repo gitolite.conf | awk '{print $NF}' | \
          grep -vi private)
          echo ${d}
          gitolite mirror push mgmt2 ${d}