I have four branches in my git repository, which is managed using GitHub:
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?.
With the -u command, your private-branch will point to the remote repository that you nicknamed as private-remote. This push also create a new branch called private-branch on your private repository.
Step 1: Navigate to your repository homepage at Github. You'll be taken to the repository settings page as shown below. Click on the branches to set the branch protection rules. You'll see the branches page where you can set the default branch for your repository and also add the branch protection rules.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With