A way to restrict Git branch access?

git, github

Solution

When using GitHub, your best option would be for each developer to have their own fork of the master repository. Everybody pushes to their own repository and somebody with push access to the master repository handles pulling from each developer's repository. This is how most open source projects work.

If using your own Git server, it should be possible to use hooks to prevent users from pushing to wrong branches.

Problem

I have four branches in my git repository, which is managed using GitHub: - Production - Staging - Master - [person's name]-development Is there a way to restrict write access to only a single branch ([person's name]-development)? How would I do this? For reference, a similar question: How to write a git hook to restrict writing to branch?.

Original source

Related problems