Real-world examples of team permissions with include/exclude patterns for flexible access control across repositories
Team management in Safe Settings allows you to centrally define team permissions across repositories with powerful pattern matching for flexible access control.
teams: # Frontend team only has access to frontend repos - name: frontend-team permission: push include: - "frontend-*" - "web-*" - "ui-components" # Backend team only has access to backend repos - name: backend-team permission: push include: - "backend-*" - "api-*" - "service-*" # Mobile team only has access to mobile apps - name: mobile-team permission: push include: - "ios-*" - "android-*" - "mobile-*"
Use case: Give teams access only to their specific repositories using naming conventions.
teams: # All engineers have access to everything except sensitive repos - name: engineering permission: push exclude: - "admin" - ".github" - "security-*" - "*-secrets" - "infrastructure-*" # Contractors have access except production and security repos - name: contractors permission: pull exclude: - "*-prod" - "*-production" - "security-*" - "admin"
Use case: Grant broad access but exclude sensitive repositories.
teams: # QA team can access all test repos except security tests - name: qa-team permission: push include: - "*-test" - "*-testing" - "test-*" exclude: - "security-test" - "pentest-*" # DevOps has admin on infrastructure except production - name: devops permission: admin include: - "infrastructure-*" - "terraform-*" - "k8s-*" exclude: - "*-production"
Use case: Fine-grained control with both inclusion and exclusion patterns.
When both include and exclude are specified, exclude takes precedence. The team will have access to repositories matching include patterns that don’t match exclude patterns.
Control whether teams are visible to all org members:
teams: # Public team visible to all org members - name: engineering permission: push visibility: closed # visible to all org members # Secret team only visible to members - name: security-incident-response permission: admin visibility: secret # only visible to team members include: - "incident-*" - "security-*"
Team visibility can only be set when creating a team. It cannot be changed for existing teams through Safe Settings.
# Default teams for all reposteams: - name: all-engineers permission: pull # Everyone can read - name: leads permission: admin # Leads have admin by default
Result:
Most repos: engineers can read, leads have admin
Frontend repos: engineers can push, frontend team has admin, designers can push
Design system: Only maintainers have admin, frontend team can push, others can read