Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 36 ยท Repositories and Collaboration

Collaborators, Roles and Repository Permissions

Invite collaborators, understand the repository roles (read, triage, write, maintain, admin), choose public, private or internal visibility, and apply least privilege.

Who can read your repository, who can push to it and who can change its settings are three different questions, and GitHub answers each with a role. Getting this right is a security habit as much as a convenience: give people the lowest role that lets them do their job.

Visibility

When you create a repository you choose who can see it:

  • Public: anyone on the internet can view and clone it. Only people you grant access can push.
  • Private: only you and people you explicitly give access to (or members of your organization with access) can see it.
  • Internal (organizations on enterprise plans): visible to all members of the enterprise, hidden from the public.

Change visibility under Settings > General > Danger Zone. Making a private repository public exposes its entire history, including old commits that contained secrets, so review before you flip it. Making a public one private detaches it from its forks and removes stars and watchers.

The five repository roles

Personal repositories have one owner and everyone else is a collaborator with write access. Organization repositories use finer-grained roles:

Role Typical person Can do
Read Non-code contributors, viewers View, clone, open issues and pull requests, comment
Triage Community managers Read, plus manage issues and pull requests (labels, assignees, close and reopen) without pushing code
Write Developers Triage, plus push to branches (subject to protection), merge pull requests, manage releases
Maintain Project managers Write, plus manage some repository settings (but no destructive or security-sensitive ones)
Admin Owners, leads Everything: settings, access, branch protection, deleting or transferring the repository

Organizations can also define custom roles on top of these (on plans that support it), selecting individual permissions.

JS Stand-in: what can this role do?

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Inviting collaborators

For a personal repository: Settings > Collaborators > Add people, type a username or email, and the person gets an invitation by email and in their notifications. Until they accept they have no access, and invitations expire after seven days. You can remove access at any time from the same page.

For an organization repository: Settings > Collaborators and teams > Add people / Add teams, then choose a role. Giving a team a role (see Organizations and Teams) is better than adding individuals because access follows membership: when somebody leaves the team, they lose access in one step.

Outside collaborators

Someone who is not a member of the organization but has been given access to one or more of its repositories is an outside collaborator. They are useful for contractors. They do not get organization-wide visibility, and owners can list and review them at People > Outside collaborators.

Least privilege in practice

  • Start new people at Read or Triage and raise it when needed.
  • Keep Admin to a small number of trusted people, and have at least two so the repository is never orphaned.
  • Use teams and review membership regularly; remove access when contracts end.
  • Protect important branches so even people with Write cannot push straight to main (see Branch Protection and Rulesets).
  • Use the Access page (Settings) to audit who has access and through which team.

Pending changes and request flow

Pull requests from forks need no access at all: anyone who can see a public repository can fork it and open one, as in Forks and Upstream. Pull requests from branches in the same repository need Write. Users with only Read can still open an issue or comment.

You can also see exactly what you are allowed to do on a repository you do not own: if the Settings tab is missing you are not an admin; if there is no Merge button on an approved pull request you are below Write, or the branch is protected.

JS Stand-in: who can open a pull request?

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A community manager needs to label and close issues but must not push code. Which role fits?

    Triage can manage issues and pull requests without write access to the code.
  2. 2. Why is it better to grant a team access than several individual users?

    Team-based access scales and keeps audits simple.
  3. 3. What is an outside collaborator?

    Outside collaborators get repository-level access without organization membership.
  4. 4. What should you check before making a private repository public?

    Making a repository public exposes every commit ever made in it.

Summary

  • Repositories are public, private or (in enterprises) internal; review history before going public.
  • The roles from lowest to highest are Read, Triage, Write, Maintain and Admin.
  • Prefer granting teams access over individuals, use outside collaborators for contractors, and apply least privilege.
  • Anyone can propose changes to a public repository through a fork, even without any role.

Next: Organizations and Teams