A product team once cleaned up their project by deleting what looked like an old test repository. An hour later, a release pipeline failed, a service connection broke, and a developer asked where his only copy of a hotfix branch had gone. The repository was not really unused. Nobody had checked what depended on it.
That is why how to delete a repository in Azure DevOps is more than a menu click. The action is easy. The risk sits in permissions, hidden dependencies, and recovery. I have helped several teams clean up cluttered Azure DevOps organizations, and the safest approach is always the same: verify, back up, delete, and monitor.
By the end of this guide, you will know how to delete a Git repository from the portal and the command line, restrict who can do it, and restore one that was deleted by mistake.
Before You Delete: Check What Depends on It
Azure DevOps is Microsoft’s platform for source control, pipelines, boards, and artifacts. If you are new to it, start with what Azure DevOps is. A repository (repo) is the Git store for one codebase, including its branches, tags, and history.
Deleting a repo is not the same as deleting a branch or a pull request. If you only need to remove a branch, read how to delete a branch in Azure DevOps instead. Deleting a repo removes everything inside it.
Run through this checklist first:
- Pipelines: Look for pipelines that use the repo as a source. Deleting it breaks them. Review what a pipeline in Azure DevOps is if you are unsure how they link.
- Open pull requests: Finish or close them. This guide explains how to abandon a pull request.
- Branch policies and builds: Policies are tied to the repo and disappear with it.
- Submodules and references: Other repos may point to this one, and their builds will fail.
- Work item links: Boards items may link to commits or pull requests in the repo.
- Unmerged work: Ask owners to confirm that no feature branch holds the only copy of important code.Pro Tip: In my experience, I rename the repo to something like
zz-to-delete-2026-12-01and wait one sprint before deleting. Anything that depends on it breaks loudly, and I can rename it back in seconds.
Check Your Permissions First
To delete a repo, you need the Delete repository permission. Project Administrators have it. In many projects, other groups such as Contributors may have it as well, depending on how the project was created and changed.
This is a governance issue. If every developer can delete repos, one wrong click can remove a production codebase. Apply least privilege, meaning you give people only the access they need.
To review or restrict the permission:
- Open Project settings and select Repositories.
- Choose All Repositories (or one repo) and open the Security tab.
- Select a group, such as Contributors.
- Set Delete repository to Deny for groups that should not delete repos.
See the screenshot below for reference.
