2009-08-27 11:54:23 +02:00
|
|
|
# migrating from gitosis to gitolite
|
|
|
|
|
2009-09-25 08:47:33 +02:00
|
|
|
[TODO: make the migration tool fix up gitweb and daemon control also...]
|
|
|
|
|
2009-08-28 02:56:23 +02:00
|
|
|
Migrating from gitosis to gitolite is pretty easy, because the basic design is
|
2009-10-11 05:01:59 +02:00
|
|
|
the same.
|
2009-08-27 11:54:23 +02:00
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
Here's how we migrated my work repos:
|
2009-08-28 02:56:23 +02:00
|
|
|
|
|
|
|
1. login as the `git` user on the server, and get a bash shell prompt
|
|
|
|
|
|
|
|
2. **disable gitosis** by renaming `/usr/bin/gitosis-serve` to something
|
|
|
|
else. This will prevent users from pushing anything while you do the
|
|
|
|
backup, migration, etc.
|
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
3. **edit** `~/.ssh/authorized_keys` and **carefully** remove all the lines
|
|
|
|
containing "gitosis-serve", as well as the marker line that says
|
|
|
|
"auto-generated by gitosis, DO NOT REMOVE", then save the file. If the
|
|
|
|
file did not have any other keys and is now empty, don't worry -- save it
|
|
|
|
anyway because gitolite expects the file to be present (even if it is
|
|
|
|
empty).
|
|
|
|
|
|
|
|
4. For added safety, **delete** the post-update hook that gitosis-admin
|
2009-08-28 02:56:23 +02:00
|
|
|
installed
|
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
rm ~/repositories/gitosis-admin.git/hooks/post-update
|
2009-08-28 02:56:23 +02:00
|
|
|
|
|
|
|
or at least rename it to `.sample` like all the other hooks hanging
|
|
|
|
around, or edit it and comment out the line that calls `gitosis-run-hook
|
|
|
|
post-update`.
|
|
|
|
|
|
|
|
If you do not do this, an accidental push to the gitosis-admin repo will
|
|
|
|
mess up your `~/.ssh/authorized_keys` file
|
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
5. take a **backup** of the `~/repositories` directory
|
2009-08-28 02:56:23 +02:00
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
Now, log off the server and get back to the client:
|
2009-08-28 02:56:23 +02:00
|
|
|
|
2009-10-30 16:55:06 +01:00
|
|
|
[inst]: http://github.com/sitaramc/gitolite/blob/pu/doc/0-INSTALL.mkd
|
|
|
|
|
|
|
|
1. follow instructions to install gitolite; see the [install document][inst].
|
|
|
|
Make sure that you **don't** change the default path for `$REPO_BASE` if
|
|
|
|
you edit the config file!
|
2009-08-28 02:56:23 +02:00
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
2. **convert** your gitosis config file. Substitute the path for your
|
|
|
|
gitosis-admin clone in `$GSAC` below, and similarly the path for your
|
|
|
|
gito**lite**-admin clone in `$GLAC`
|
2009-08-28 02:56:23 +02:00
|
|
|
|
2009-11-13 00:33:09 +01:00
|
|
|
src/gl-conf-convert < $GSAC/gitosis.conf > $GLAC/gitolite.conf
|
2009-08-28 02:56:23 +02:00
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
Be sure to check the file to make sure it converted correctly
|
2009-08-28 02:56:23 +02:00
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
3. **copy** the keys from gitosis's keydir (same meanings for GSAC and GLAC)
|
2009-08-28 02:56:23 +02:00
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
cp $GSAC/keydir/* $GLAC/keydir
|
2009-08-28 02:56:23 +02:00
|
|
|
|
2009-10-30 16:55:06 +01:00
|
|
|
4. **Important: expand any multi-key files you may have**. [Here][mk]'s an
|
|
|
|
explanation of what multi-keys are, how gitosis does them and how gitolite
|
|
|
|
does it differently.
|
|
|
|
|
2009-08-28 02:56:23 +02:00
|
|
|
You can split the keys manually, or use the following code (just
|
2009-10-11 05:01:59 +02:00
|
|
|
copy-paste it into your xterm after "cd"-ing to your gitolite-admin repo
|
|
|
|
clone):
|
2009-08-28 02:56:23 +02:00
|
|
|
|
|
|
|
wc -l keydir/*.pub | grep -v total | grep -v -w 1 | while read a b
|
|
|
|
do
|
|
|
|
i=1
|
|
|
|
cat $b|while read l
|
|
|
|
do
|
|
|
|
echo "$l" > ${b%.pub}@$i.pub
|
|
|
|
(( i++ ))
|
|
|
|
done
|
2009-08-29 07:21:48 +02:00
|
|
|
mv $b $b.done
|
2009-08-28 02:56:23 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
This will split each multi-key file (say "sitaram.pub") into individual
|
|
|
|
files called "sitaram@1.pub", "sitaram@2.pub", etc., and rename the
|
|
|
|
original to "sitaram.pub.done" so gitolite won't pick it up.
|
|
|
|
|
|
|
|
At this point you can rename the split parts more appropriately, like
|
|
|
|
"sitaram@laptop.pub" and "sitaram@desktop.pub" or whatever. *Please check
|
|
|
|
the files to make sure this worked properly*
|
|
|
|
|
2009-10-11 05:01:59 +02:00
|
|
|
5. Check all your changes to your gitolite-admin clone, commit, and push
|
2009-11-05 09:29:36 +01:00
|
|
|
|
|
|
|
[mk]: http://github.com/sitaramc/gitolite/blob/pu/doc/3-faq-tips-etc.mkd#multikeys
|
|
|
|
|