Collaborators and permissions
Last updated
Carla wants to help type up Lola Remy's notebook, and Joaquin wants to fix the pancit. On GitHub, only the owner can push until they let others in. In this lesson you'll see who can do what to a repository, how to invite a collaborator, and when to give less access, or none, and let people use a fork instead.
By the end of this lesson you can
- Invite a collaborator to a personal repository, and say what they can then do
- Match people to the right level of access in an organisation: read, triage, write, maintain or admin
- Remove access, and choose forks for people who shouldn't have any
Who can do what
For a public repository on a personal account, there are three kinds of people:
| Who | Can read and clone | Can open issues and pull requests | Can push and merge | Can change settings and delete it |
|---|---|---|---|---|
| Anyone with a GitHub account | Yes | Yes | No | No |
| A collaborator | Yes | Yes | Yes | No |
| The owner | Yes | Yes | Yes | Yes |
A private repository is the same, except that "anyone" can't see it at all.
So strangers can still help without any access: they fork the repository (their own copy, lesson 5.5), change that, and open a pull request asking the owner to take the change.
Inviting a collaborator
In Settings › Collaborators, the owner adds people by their GitHub username:
- Manage access. Who can see the repository, and who can push. Only the owner sees this page.
- Add people. Find someone by username or email and invite them.
- A collaborator. Carla accepted, so she can push, make branches and merge pull requests. Remove takes it away straight away.
- A pending invite. Joaquin hasn’t accepted yet. Invitations arrive by email and in GitHub’s notifications; access starts only once they accept.
On a personal account there's only one level: a collaborator can push to every branch. To stop anyone, collaborators included, pushing straight to main, the owner adds a branch rule that requires a pull request first (lesson 7.4).
Organisations and roles
When a group shares projects, such as a club, a class or a company, they make an organisation: an account owned by a group, like reyes-family. Its repositories can give each person, or each team of people, one of five roles:
| Role | Who it's for | Can do |
|---|---|---|
| Read | People who only need to look, or to comment | Read and clone, open issues, comment |
| Triage | People who sort issues and pull requests, without changing code | Read, plus label, assign and close issues and pull requests |
| Write | People who change the project | Triage, plus push, make branches and merge pull requests |
| Maintain | People who run the project day to day | Write, plus some settings, such as the description and topics |
| Admin | The few people responsible for it | Everything, including access, branch rules and deleting the repository |
GitLab has the same idea with different names (Guest, Reporter, Developer, Maintainer, Owner); Codeberg too. The rule is the same everywhere: give each person the least access that lets them do their part.
Who gets what?
The family moves Kusina into a reyes-family organisation. Which role for each person?
0 of 6 placed right
Lola Remy, who reads the recipes and sometimes leaves a comment, through Ana
Carla, who types up recipes most weeks and reviews Joaquin’s
Ana, who started it and looks after its settings
Tito Ben, who wants to label the recipe requests and close the duplicates
A stranger who found a typo in the sinigang
Joaquin, who adds a recipe now and then
Spot the trap: admin for everyone
Setting up the reyes-family organisation, Ana gives everyone Admin “so nobody has to ask me for anything”.
What happens if…
Check what you learned
Sources
Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.
- GitHub Docs: Inviting collaborators to a personal repository: the invitation, and accepting it
- GitHub Docs: Permission levels for a personal account repository: what the owner and collaborators can each do
- GitHub Docs: Repository roles for an organization: read, triage, write, maintain and admin
- GitLab Docs: Roles and permissions: the same idea on GitLab, with different role names