Configuring Repository Permissions
This lesson explains permissions in Azure Repos and repository roles in GitHub.
Learning outcomes
After completing this lesson, you will be able to:
- Describe Azure Repos permission levels.
- Explain how Deny and Allow resolve.
- Describe the five GitHub repository roles.
- Apply least privilege to repositories.
Permissions in Azure Repos
Azure Repos permissions are set under Project settings > Repositories. They exist at three levels: all repositories in a project, a single repository, and a single branch. Lower levels inherit from higher ones, so a default can be set for all repositories, then tightened where required.
The following permissions are the ones that matter most.
| Permission | What it allows |
|---|---|
| Read | Clone and view the code |
| Contribute | Push to branches and create branches |
| Contribute to pull requests | Create and comment on pull requests |
| Create branch | Create new branches |
| Create tag | Create tags |
| Force push (rewrite history, delete branches and tags) | Rewrite or delete history |
| Bypass policies when completing pull requests | Complete without meeting branch policies |
| Bypass policies when pushing | Push directly despite branch policies |
| Manage permissions | Change who has access |
Each permission can be Allow, Deny, or Not set. An explicit Deny overrides an inherited or group Allow, and Not set means that access is denied unless granted elsewhere. Because users usually belong to several groups, the effective permission is what matters, and the permissions page shows a Trace link that explains how a value was reached. Permissions should be given to groups, such as Contributors or a custom group, and not to individuals.
Branch-level permissions allow patterns such as limiting who can create branches at the root. Some teams require branches in folders, such as users/ or feature/, by denying branch creation at the root and allowing it within those folders.
Effective permissions in Azure Repos
Permissions in GitHub
In GitHub, access comes from repository roles. The five standard roles form a ladder, each including what comes before it.
| Role | Intended for | Key abilities |
|---|---|---|
| Read | Viewers and contributors who raise issues | Clone, open issues and comment |
| Triage | People who manage issues without writing code | Label, assign and close issues and pull requests |
| Write | Active contributors | Push to non-protected branches, and merge pull requests |
| Maintain | Project managers of a repository | Manage some settings, without destructive actions |
| Admin | Repository owners | Full control, including settings and deletion |
Roles are best assigned to teams. An organization's base permission sets what all members receive on all repositories, and it should be low, usually Read or No permission. GitHub Enterprise Cloud supports custom repository roles, which add fine-grained permissions to a base role, for example allowing someone to manage webhooks without broader administration. The module on authentication covers GitHub roles at organization level.
Which GitHub repository role?
Applying least privilege
Several principles apply on both platforms. Grant access through groups so that a leaver's access ends with their group membership. Give pipelines their own limited identity and not a person's credentials. Keep the number of administrators small. Review access regularly. Note that in Azure Pipelines, the Project Build Service identity usually needs Contribute permission on a repository only if a pipeline pushes back to it, for example to create tags.
The following diagram resolves a contractor's effective Contribute permission from an inherited Allow and an explicit Deny.

Least privilege for repositories
Restricting one person
In Azure Repos, a contractor belongs to the Contributors group, which allows Contribute on all repositories. The contractor must not push to one sensitive repository, but must keep access to the others. What should you do with the least effort?
You should add a Deny on Contribute for the contractor, or for a group holding such contractors, on that one repository. Deny overrides the Allow inherited from Contributors. Removing the contractor from Contributors would remove access to the other repositories. Clearing the group's Allow on that repository would affect all contributors.
A permission is Not set at every level for a user. Can the user perform the action?
Show answer
No. Not set is an implicit deny, unless an Allow exists from another source.
Exam Tips
Remember for the exam
- Azure Repos permissions exist at project, repository and branch levels.
- Deny overrides Allow; Not set means no access unless granted elsewhere.
- GitHub roles: Read, Triage, Write, Maintain, Admin.
- Assign roles to teams, and keep base permissions low.
- Restrict force push and bypass permissions to a very small group.