简体   繁体   中英

Is there a way to limit commits on a Git branch to certain people?

I want to be able to ensure that only our automated deployment solution can promote code from the developer branch up to our QA and up to our production branches (where no work is actually performed, save for hotfixes which are quite seldom and are very controlled). ie I want to make sure that developers only work off the developer branch and dont mistakenly make any commits to our QA or production branches.

What is the way to accomplish this?

Use Gitolite

While you might be able to do some limited permissions checking on a shared local repository using pre-commit hooks , this is generally not a good way to proceed and hard to enforce. It is also not useful when dealing with multiple clone scenarios.

The current best practice is to use gitolite with a carefully crafted refex for the branch permissions. Gitolite can be quite complex, but it should certainly allow you to limit commits on specific branches to individual useers or designated groups.

If you want a GUI for access control configuration, then you can also try Gerrit . While Gerrit is primarily a code review tool, it also supports fine grained permissions, groups and different authentication sources (Openid, LDAP, etc.).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM