Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GithHub: Restrict user who can push to public repository

Tags:

github

I want to start a new public repository but restrict who actually can push to certain branches like master or develop.

According to GitHub's help page about protected branches, Branch protection rules have an option called "Restrict who can push to matching branches".

Looking at my repository I cannot find this option. Is it limited to some paid plans? And if so: How do open source projects protect their GitHub repositories?

like image 298
Hannes Avatar asked Oct 26 '25 00:10

Hannes


1 Answers

Your question seems to be based on a misunderstanding of what "public" means in this context. Public repositories are publicly readable but not writable.

Anyone can clone the repository, but only collaborators that you invite can write to it. You don't need to do anything to stop people committing to master or develop.

If someone you haven't invited to become a collaborator wants to submit something to your repository then they can:

  1. Fork your repository
  2. Commit their changes to their fork of it
  3. Issue a pull request asking you to merge their changes
like image 100
Quentin Avatar answered Oct 27 '25 19:10

Quentin