In a situation where the admin of a gitolite server needs to use a new pair of ssh keys, the obvious challenge is to make the necessary changes in the gitolite system to update the admin’s new public key.
First up, ssh into the gitolite server. You can do this using your new pair of ssh keys.
Doing this will not only add the gitolite server to your known hosts, but also, create a terminal to run a few commands on the gitolite server.
Once you’ve managed to start an ssh session, open another terminal and send across your public key:
scp ~/.ssh/id_rsa.pub gitolite-user@gitolite-server:email@example.com
you can use anything instead of firstname.lastname@example.org. We’ll change it later anyways. The last command would’ve sent across your public ssh key to the gitolite server. Now go to your ssh terminal, and verify the same using ls. You need to rename the new public key you just sent across to have the exact same name as your previous admin public key. So if the previous admin public key was named, git-admin.pub, then you’ll need to do the following:
mv email@example.com git-admin.pub
It would be wise to backup the old admin public key, just in case it’s in the same folder as your new key.
Once you’ve done this, all you need to do is run the gl-setup script using the new key. I’m assuming that the bin folder, having the gitolite scripts, is on the system $PATH.
That’s it. This should have successfully updated the gitolite admin’s public key. You can verify the same on the machine [with the new admin key], by cloning the gitolite-admin repository:
git clone gitolite-user@gitolite-server:gitolite-admin.
NOTE: Please don’t confuse this writeup with adding a new ssh key for the admin gitolite user, so that he/she can access the gitolite repositories from a separate machine. This writeup is specifically meant to cater to the situation wherein you need to set up the gitolite admin functionality using a new ssh key pair. This situation can arise from losing old admin keys, or, moving to a different machine.