authorized_keys not updated / old repositories not cleaned up after upgrade (3.1->4.0)
Created by: repsejnworb
I added the authorized_keys not updated in the title as this is the symptom most users will experience when running into this issue.
After you have upgraded from 3.1 to 4.0 /home/git/.gitolite/conf/gitolite.conf
is not correctly updated, the old repositories are still present (by 'old' I mean the ones that got moved into a new namespace).
The same goes for the actual files under /home/git/repositories
.
What this leads to is that when you try to change any configuration (in my case, adding a new ssh-key) then gitolite will fail when trying to change things in these old repositories (because the upgrade changed the permissions). This is no "try, except", so gitolite will just stop - and therefore not run its post-update scripts (hence, not adding any new ssh-keys).
Example log output:
2012-12-25.15:15:32 15114 ssh ARGV=gitlab SOC=git-receive-pack 'gitolite-admin' FROM=::1
2012-12-25.15:15:32 15114 access(gitolite-admin, gitlab, W, 'any'),-> refs/.*
2012-12-25.15:15:32 15114 trigger,Writable,access_1,ACCESS_1,gitolite-admin,gitlab,W,any,refs/.*
2012-12-25.15:15:32 15114 pre_git gitolite-admin gitlab W any -> refs/.*
2012-12-25.15:15:32 15114 system,git,shell,-c,git-receive-pack '/home/git/repositories/gitolite-admin.git'
2012-12-25.15:15:32 15114 update,gitolite-admin,gitlab,W,refs/heads/master,d2cef3b0b0d368a1a086a54837d3547e03f4b78b,6a5cb58a44a6c8f057604f5a338ebb5869471650
2012-12-25.15:15:32 15114 -> refs/.*
2012-12-25.15:15:32 15114 update gitolite-admin gitlab W refs/heads/master d2cef3b0b0d368a1a086a54837d3547e03f4b78b 6a5cb58a44a6c8f057604f5a338ebb5869471650
2012-12-25.15:15:32 15114 post-up,refs/heads/master
2012-12-25.15:15:32 15114 system,gitolite compile
2012-12-25.15:15:32 15114 die could not symlink /home/git/.gitolite/hooks/common/post-receive to build-environment.git/hooks<<newline>> at /home/git/gitolite/src/lib/Gitolite/Conf/Store.pm line 330<<newline>>
2012-12-25.15:15:32 15114 system() failed,gitolite compile,-> 6400
2012-12-25.15:15:32 15114 END
I solved this the real way by checking out the gitolite repo and removing these repositories from the config (remember to do it all as the gitlab user, "sudo -u gitlab -H git clone", "sudo -u gitlab -H git commit", "sudo -u gitlab -H git push origin") and then I manually removed (as I am paranoid I actually just moved them away) all the old repositories under /home/git/repositories
.
I hope this will help someone running into the same issue.
And for the upgrade procedure I would vote for adding something about backing these folder up and then clean them out.