Showing posts with label gitolite. Show all posts
Showing posts with label gitolite. Show all posts

Saturday, January 5, 2013

Gitolite - permissions examples

Attention: Gitolite version 2.
Deny permission completely(no access for clone) for user @trial user group, all other full access:


@trial  = denis


repo    my_repo
   - =   @trial
   RW+  =   @all
   config gitolite-options.deny-repo = 1


Give user Jenkins permission only for Read/Fetch/Clone, all other full access:

repo    my_repo
   R    =   jenkins
   -    =   jenkins
   RW+  =   @all

Forbid "git push --force" for 'master' branch only to avoid repository history damage, all other branches could be rewinded ('--force'):

repo    my_repo
   RW  master  = @all
   -   master  = @all
   RW+         = @all



Examples: site1, site2,

Friday, December 14, 2012

Gitolite - get access to repository for all users except for one

All is written in manual :), it only takes a bit time to read all, try a lot to make it work.

general description about rules: http://sitaramc.github.com/gitolite/rules.html
Nuances about deny meaning: http://sitaramc.github.com/gitolite/g2/aac.html#deny

Deny - does not forbid read access by default.

Mu config, to give access to all except for mihail (trial group) that have access only to project3:

@trial    =  mihail

repo    project1
        -       =   @trial
        RW+     =   @all
        config gitolite-options.deny-repo = 1


repo    project2
        -       =   @trial
        RW+     =   @all
        config gitolite-options.deny-repo = 1


repo    project3
        RW+     =   @all




Tuesday, December 11, 2012

How to create new repo at gitolite



1. get access to gitolite-admin repository

2. clone it and do changes to git/gitolite-admin/conf/gitolite.conf

3. do push

4. update Cgit website configuration at git.yourcomapny.com file /etc/cgitrc

5. provide mail notifications: copy 'config' from existing repo to new repo at server.


"<repo>/config" content:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = true
[hooks]
        mailinglist = git-commit@company.com
        emailprefix="[GIT] "
    showrev = "echo "All Branches: "; git branch; echo; echo "Summary of changes:"; git log $oldrev..$newrev; echo; echo; git diff-tree -p --stat --summary --find-copies-harder $oldrev..$newrev;"




To automate all this steps please read this.

Attention: command for 'showrev' is not ideal and send empty mail in case of branch merges, and branch removal.

Monday, December 3, 2012

Gitolite - Change default config template file for repositories

We use gitolite for git server, and we use mail notifications after any push to repositories to manage and be notified about changes that are done by other developer.

After push in gitolite-admin repository, I need to login to git server and manually copy hook file and config for hook:
/home/git/repositories/REPO-NAME.git/config
/home/git/repositories/REPO-NAME.git/hooks/post-receive

My thread in google group to make automatically.