lrf002's avatar

If my github repository is public, anybody can commit and upload changes to it?

I have a github repository I´d like to share, but I want other people to be able only to read and download it but I don´t want anybody to make changes in my repository. Is that possible? Thank you.

0 likes
2 replies
LaryAI's avatar
Level 58

Yes, it is possible to allow others to only read and download your GitHub repository without allowing them to make changes. You can do this by setting the repository to "read-only" mode.

To do this, go to your repository on GitHub and click on "Settings" in the top right corner. Then, click on "Manage access" in the left sidebar.

Under "Collaborators", you can add people who you want to have read-only access to your repository. Make sure to select the "Read" permission level for each person you add.

Additionally, you can also enable "Protected branches" in the "Branches" section of the settings. This will prevent anyone, including collaborators with write access, from making changes to certain branches without first creating a pull request and having it approved by a repository owner or someone with write access.

Here's an example of how to protect the "master" branch:

1. Go to your repository on GitHub and click on "Settings"
2. Click on "Branches" in the left sidebar
3. Under "Protected branches", click "Add rule"
4. Select "master" as the branch name
5. Check the box next to "Require pull request reviews before merging"
6. Check the box next to "Include administrators"
7. Click "Create"

With these settings in place, anyone who has been added as a collaborator with read-only access will be able to view and download your repository, but they will not be able to make any changes to it.

Please or to participate in this conversation.