Moving gitolite

Step by step introdutions to move a gitolite server

maybe pack these into a script one day

Definitions:

  • OLD - your old gitolite server
  • NEW - your clean shiny new gitolite server
  • ADMIN - doesn’t matter, any machine can execute git and have gitolite-admin acces in OLD

    on OLD

    pack old things up!
    1
    2
    3
    su git
    cd ~
    tar cf pack.tar repositories/ .gitolite.rc .gitolite/hooks/common

on NEW

use sudo whenever you need it

install git

1
apt-get install git

create gitolite user

1
useradd -d /opt/gitolite -m -p "!" -s /bin/bash git

intall gitolite

1
2
3
4
5
6
7
su git
cd ~
echo "pubkey on ADMIN" > [USER].pub # create admin key
git clone https://github.com/sitaramc/gitolite.git
mkdir -p ~/bin
./gitolite/install -ln ~/bin
gitolite setup -pk [USER].pub

get old repos back

1
2
3
4
5
6
mkdir ~/tmp
scp OLD:pack.tar ~/tmp
cd ~/tmp
tar zxf pack.tar
rm -rf repositories/gitolite-admin.git repositories/testing.git/ # rm default repos
mv repositories/* ~/repositories/

apply rc configs if the gitolite version between OLD and NEW are close enough

or check any diff of ~/.gitolite.rc and ~/tmp/.gitolite.rc to manually apply it

1
cp ~/tmp/.gitolite.rc ~/

restore hooks (this probably getting old, check this to manage hooks)

1
cp ~/tmp/.gitolite/hooks/common/* ~/.gitolite/hooks/common/

on ADMIN

get a newest admin configs

1
2
git clone git@OLD:gitolite-admin
cd gitolite-admin

set new origin

1
git remote set-url origin git@NEW:gitolite-admin

test is the admin key worked

1
git fetch origin

push configs

1
git push -f