Migrating from gitolite to gerrit
So i have been working more and more... or trying at least with gerrit and was having some issues. Well my problem was i was using gitolite. Gitolite has some hooks that would need to be removed from the project before you could use gerrit and commit changes. Below are my notes, use at your own risk. Not that you would lose anything, you back everything up right?! :-D
Remove Gitolite hooks
Just remove these files from your project. This is on the master server that has you git repo. go into the projects hook directory and then
[gerrit@git my_project.git ]$ rm -f gitolite-hooked gl-pre-git.hub-sample post-receive.mirrorpush update update.secondary.sample
Fixing permissions
So after i removed the hooks i still needed to fix permissions. I don't fully understand gerrit, however i was able to do this to allow me to change the permissions without a review. This may be wrong, however it works for me and until i learn otherwise i will continue to do it.
Create tmp directory
Create a temporary directory and do a git init inside it
[gerrit@git sandbox]$ mkdir tmp
[gerrit@git sandbox]$ cd tmp
[gerrit@git tmp]$ git init
Then pull in the project you want to fix permissions on.
[gerrit@git tmp]$ git pull /data/git/repositories/my_project.git refs/meta/config
This will give you the files that you will want.
Note: You will need to visit the project once in gerrit to get it to create the generic "config" files
Setting permissions
Create a new file called groups. In that file add the Group UUID and Group Name
# UUID Group Name #
c5a45e67f3d27518770bb3810f4bf02bef2739fb Administrators
You can find your group UUID and name in the gerrit site under Group->List->Administrators->General The UUID will be at the top of the page.
Save that file and then edit the project.config file. Make it look something like the following.
[access "refs/heads/*"]
push = group Administrators
owner = group Administrators
pushMerge = group Administrators
exclusiveGroupPermissions = pushMerge
[project]
description = My Test project
state = active
Now add the two new files with git add and then commit with comment. I should not need to tell you how to do that, if i do i will hear about it in the comment section below. Once you are done that the final step is to push this all back up into the project.
[gerrit@git tmp]$ git push /data/git/repositories/my_project.git/ HEAD:refs/meta/config
That's all it takes. You are good to go now. You should be able to push changes to your project hosted by gerrit.