I have 10 main folders in this project I want to give access to the external team just in one sub-folder in my git repository so that they can make changes and submit a Pull Request.
Is there a way of doing it? If not, can you please suggest a better way?
On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. In the "Access" section of the sidebar, click Collaborators & teams. Under "Manage access", in the search field, start typing the name of the team or person you'd like to find.
Select the GitHub App whose permissions you want to change. In the left sidebar, click Permissions & webhooks. Modify the permissions you'd like to change. For each type of permission, select either "Read-only", "Read & write", or "No access" from the dropdown.
Owner access for a repository owned by a personal accountThe repository owner has full control of the repository. In addition to the actions that any collaborator can perform, the repository owner can perform the following actions.
There is no such access-rights-mechanism implemented on GitHub repositories out of the box.
Using a submodule does the trick, and is pretty much easy to set up. You can give the customers full access to the submodule repository, while you add it to your main project repository.
Note that the StackOverflow question "Using someone else's repo as a Git Submodule on GitHub" and its answer are also worth reading.
This is in my opinion the most simple and straightforward way to do it.
If you really don't want to use submodules, you can still restrict access rights by creating a GitHub webhook that implements this mechanism. The Git SCM documentation explains how to do that part.
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