Search code examples
linuxgitubuntupushgitosis

Make a GIT repository read only for some users using gitosis


We are running a GIT repository using gitosis and we need to forbid the push to some people of the team.

So i want everybody have read access to all repositories (got +10 repo and +20 machines where the users can do commit pull and push)

I need to restrict only the push, i want user can continue doing pull and clone but not push, only 2 users can push to master.

So any ideas? maybe to ask a password before make push?


Solution

  • You do this in the gitosis.conf file. Create two groups, one for those who can write to the repo, and one for those who have read-only access:

    [repo my_repo]
    description = Git repository for foobar
    owner = user1
    
    [group my-repo]
    writable = my_repo
    members = user1 user2
    
    [group readonly]
    readonly = my_repo
    members = user3 user4 user5