Restrict GitHub repository access to one team

Use this procedure when a private organization repository should be accessible through one intended team. You need repository Admin access to edit grants and an organization owner to change base permissions or organization roles.

Configuration to aim for

One team grant, with privileged exceptions recorded

Keep the repository private, set base permissions to None, grant the intended team access, and remove overlapping grants. Organization owners retain Admin access. Security managers and other roles with repository permissions can also remain outside the team boundary; review and record those exceptions before calling the result team-only.

For background, read Who can see a private GitHub repository?. The steps below change permissions; making a team secret is not a substitute.

1. Confirm the repository is private and record existing access

Check the repository's visibility badge. Public and internal repositories are not suitable for this team restriction: internal visibility can provide enterprise-wide Read access even with base permissions set to None. If a visibility change is needed, review GitHub's visibility-change guidance before proceeding.

Record the intended team, its required role, the current grants, and legitimate exceptions. Confirm who needs access for routine work before removing a broader grant.

2. Remove default member access at organization level

An organization owner should open Organization Settings → Member privileges → Base permissions, select None, and confirm the change after reviewing its impact.

GitHub organization navigation with the Settings tab outlined; Member privileges is inside Settings
Start in organization Settings, then open Member privileges. Unmodified screenshot from GitHub Docs, CC BY 4.0.

3. Add the intended team directly to this repository

Open Repository Settings → Collaborators & teams. Use Add teams to select the intended team and assign its required role, such as Read for viewing or Write for contribution. Check the existing grant instead if the team already has access.

GitHub repository navigation with the Settings tab outlined; Collaborators and teams is inside Settings
Use repository Settings for team and individual grants. Unmodified screenshot from GitHub Docs, CC BY 4.0.

Review the team's members and children. A parent grant also reaches its child teams. Put the grant on the narrower team when that matches the intended audience; adding a narrower grant alone does not cancel a broad one.

4. Remove overlapping paths at their source

Removing a team or person can delete their private forks when no other access remains. It does not remove existing local clones. Review GitHub's access-removal guidance before making the change.

5. Verify the resulting audience

For example, if Engineering and its child Payments both have Write, adding Payments leaves Engineering's audience intact. Grant Payments directly, remove Engineering's grant, then check that Payments still has Write and unrelated Engineering members have no remaining path.

Record the repository, reviewed paths, retained exceptions, reviewer, and date. Repeat the check after changes to membership, hierarchy, or roles. For reviews across repositories, use the GitHub repository permissions audit checklist.

Check the access paths into your private repositories

Review team coverage and direct grants alongside the organisation base permission. A private repository can still be accessible through several paths.

View example results Audit your GitHub organisation

No account needed for first results. You will need a GitHub token with the required read permissions.

Related guides

Sources