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.
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.
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.
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
- Other team grants: remove unwanted grants from the repository access list. For inherited access, remove or change the originating parent-team grant.
- Direct collaborators: review each individual grant and remove those no longer required, including outside collaborators. Check Direct access vs Organization access when a person has both routes.
- Organization roles: ask an owner to review security managers and other assignments that provide repository access. Keep required privileged access documented; do not remove an operational role solely to tidy the team list.
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.
- The repository is Private, and organization base permissions are None.
- The intended team has the required role; its members and any child teams match the agreed audience.
- No unwanted team, parent, direct member, or outside-collaborator grant remains.
- Organization owners and retained roles with repository access are explicitly recorded.
- An authorized member of the intended team can open the repository. An ordinary member outside the intended audience, with no privileged role or other grant, cannot.
- If the boundary must also cover automation, review GitHub Apps and deploy keys separately. The team list alone does not establish their access.
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
- Who can see a private GitHub repository?
- GitHub Teams hierarchy and repository permissions
- GitHub Direct access vs Organization access
- Manage GitHub repo visibility with nested teams using repod
- GitHub repo access audit guide
- GitHub access audit tool