master TOC | chapter TOC | support
[NOTE: I would appreciate help testing these instructions]
Just copying everything won't work unless everything on the new server is exactly the same. I suggest you don't try it unless you know what you're doing.
Assumptions
$REPO_BASE on either of the servers; if you did,
substitute accordinglyThere are many ways of doing this, but the most generic set of steps are given below. Please follow all the steps; do not skip or improvise! Ask me if things are not clear -- you can help me fine tune this document :-)
(workstation, old server) pull the latest changes to the
gitolite-admin repo to your workstation, if you don't have them
already. You'll need them later on.
(old server) disable the old server so your users will not push any
changes to it. There are several ways to do this, but the simplest is to
insert this line at the top of ~/.gitolite.rc on the old server:
exit 1;
(new server) copy the repos to the new server, except the
gitolite-admin repo and files called gitolite-hooked in the hooks
directory of each repo.
That sounds complicated but it's not. It's just:
cd $HOME
rsync -a olduser@oldhost:repositories .
mv repositories/gitolite-admin.git $HOME/old-gitolite-admin.git
find repositories -name gitolite-hooked | xargs rm
Don't forget to chown repositories if git's UID changed. Gitolite expects the hosting user to own all the files and directories it manages.
(workstation, new server) install gitolite normally on your new server. Use whatever install method suits you, but you must use the same name for the admin ("YourName" in the install instructions). You may use a different keypair if you need to, or use the same one that currently gets access to the old server.
(new server) edit the ~/.gitolite.rc file to match the settings on
the old server, if needed. Do not copy the entire file outright -- some
of the variables (notably GL_PACKAGE_CONF and GL_PACKAGE_HOOKS) are
installation dependent and should not be touched! Do a diff or a vimdiff
and copy across only what you know you changed on the old server.
(workstation) push the config to the new server. To do this, go to your admin clone, and:
if you used a different keypair when installing to the new server,
copy that pubkey to this clone into keydir/Yourname.pub, then add
and commit the change to the pubkey
cd gitolite-admin
cp path/to/new/YourName.pub keydir/YourName.pub
git add keydir
git commit -m "new server, new key"
if you did not use a different keypair, just make a dummy commit
git commit -m "new server" --allow-empty
set the URL for the new server
git remote set-url origin git@newserver:gitolite-admin
push the config, including past history
git push -f
And that should be that!