如何配置GitHub新仓库默认权限,使团队成员可作为PR潜在审核者?
Got it, this is a super common pain point when setting up new repos in GitHub orgs—luckily, there are a few straightforward settings you can tweak to fix this permanently. Here's how to make sure your team members automatically show up as potential PR reviewers for every new repo you create:
1. Adjust Organization-Wide Default Repository Permissions
First, let's fix the root issue: new repos are restricted to admins by default. You can set a base permission level for all org members to access new repos automatically:
- Head to your organization's main page and click the Settings gear icon in the top right
- Navigate to Repositories under the "Code, planning, and automation" menu
- Find the Default repository permission dropdown. Swap the default "No permission" to Read (or "Triage" if you want team members to manage issues too). This ensures every new repo grants basic access to all org members right away, making them eligible as reviewers.
- Note: If you only want specific teams (not the entire org) to get access, skip this step and jump to the next one.
2. Auto-Add Specific Teams to All New Repositories
If you work with multiple teams and only want certain groups to have access to new repos, you can set up automatic team assignment:
- Stay in your org's Settings and go to the Teams tab
- Select the team you want to grant automatic access to new repos
- Click the Settings tab for that team, then scroll down to the Repository access section
- Look for the option labeled Automatically add this team to new repositories (it might be under an "Advanced" toggle depending on your org setup)
- Enable this option, and confirm the team has at least Read access (this is the minimum required to be a PR reviewer). Now every new repo you create will automatically include this team.
3. Lock in Branch Protection (Optional but Recommended)
To make sure PRs require reviews and your team is easily selectable, set up org-wide or repo-specific branch protection rules:
- For a single repo, go to its Settings > Branches
- Edit your main branch's protection rule
- Enable Require a pull request before merging
- In the Reviewers section, you can even set your team as the default required reviewers—but even if you don't, with the team having repo access, all members will appear in the "Reviewers" dropdown when you create a PR.
Quick Troubleshooting
If team members still don't show up as potential reviewers:
- Double-check the team is listed in the repo's Settings > Access tab
- Confirm the team members are properly added to the target team in your organization
- Make sure the team has at least Read permissions on the repo (higher permissions like "Write" work too)
内容的提问来源于stack exchange,提问作者Josh C

