Moving gitolite server

前端 未结 2 2155
面向向阳花
面向向阳花 2021-02-19 13:43

I have a working gitolite server. However, I want to move it to an identical configuration, but on a bigger machine. Even though I have gitolite working, I am not sure about t

2条回答
  •  耶瑟儿~
    2021-02-19 13:54

    What you will need is also to move your ssh config:

    ~/.ssh/authorized_keys
    

    That is the file used by SSH and configured by Gitolite in order to:

    • list all the authorized public key
    • associated it with a forced-command script
    • pass the right user name to the gitolite script

    See "How Gitolite uses ssh"


    The OP confirms that was the issue and points out to the Gitolite documentation:
    "moving the whole thing from one server to another":
    (note: this is for 'g2'; ie Gitolite V2, but the idea is the same for Gitolite V3 or 'g3')

    The idea behind this process is to create a new Gitolite instance, and then push your existing Gitolite repo, which will redeclare automatically all your current existing keys in your new server ~/.ssh authorized_keys for you.

    • install gitolite. Don't worry about the pubkey used in the gl-setup step -- for example this will do fine:

      ssh-keygen -q -N '' -f dummy gl-setup -q dummy.pub

    • edit the rc file to have similar settings to the old one.

    • 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.

    • 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;

    • copy the contents of $REPO_BASE in the old server to $REPO_BASE on the new server.
      By default, as you know, these are both $HOME/repositories.

    • chown -R the files to the correct user if you copied using root.

    • fix up the hooks

      gl-setup

    • trigger a push to the admin repo

      git clone repositories/gitolite-admin.git /tmp/gitolite-admin cd /tmp/gitolite-admin git commit --allow-empty -m 'trigger compile on new server' gl-admin-push -f

提交回复
热议问题