Search code examples
gitversion-controlgitolite

How can I use gitolite to limit developers to development branch only:


We are looking to use gitolite and git but we are trying to find a way to stop the developers from pushing (commiting) code to the release branch of the repo

We want to give the developers access to the master and development branches only. Can this be done using gitolite? How?


Solution

  • Yes, that's exactly what gitolite is for. Make a developers group:

    @developers = <list of developers>
    @releasers = <list of people allowed to push to release branch>
    

    And then set up the access rules:

    repo <reponame>
        RW release = @releasers      # allow @releasers access to release branch
        - release = @developers      # deny @developers access to release branch
        RW master = @developers      # allow @developers access to master branch
        RW development = @developers # allow @developers access to development branch
        - = @all                     # deny all other permissions
    

    Or something more complicated as you see fit.