Skip to content

Latest commit

 

History

History
110 lines (67 loc) · 4 KB

delete-existing-repo.md

File metadata and controls

110 lines (67 loc) · 4 KB
title titleSuffix description ms.assetid ms.service ms.topic ms.date monikerRange ms.subservice
Delete a Git repo from your project
Azure Repos
Remove an existing Git repo in an Azure DevOps Services or Team Foundation Server project
271f8473-e77d-4a95-80d9-0bd347de7533
azure-devops-repos
conceptual
03/31/2022
<= azure-devops
azure-devops-repos-git

Delete a Git repo from your project

[!INCLUDE version-lt-eq-azure-devops]

Remove unused Git repos from your project when they are no longer needed. The steps in this article show how to delete a Git repo from your Azure DevOps project. If you want to delete the entire project, see Delete a project.

Important

You cannot remove a repo if it is the only Git repo in the Azure DevOps project. If you need to delete the only Git repo in a project, create a new Git repo first, then delete the repo.

Prerequisites

::: moniker range="azure-devops"

Note

If you want to use the Azure DevOps CLI az repos delete command, follow the steps in Get started with Azure DevOps CLI. ::: moniker-end

Delete a Git repo from the web

Tip

Consider renaming the repo and locking its default branch instead of removing it. The commit history of the repo will be lost when it is deleted.

::: moniker range=">= azure-devops-2019"

  1. Select Repos, Files.

    View your branches

  2. From the repo drop-down, select Manage repositories.

    Manage repositories

  3. Select the name of the repository from the Repositories list, choose the ... menu, and then choose Delete repository.

    Delete repository

  4. Confirm the deletion of the repository by typing the repo's name and selecting Delete.

    Delete repository confirm

::: moniker-end

::: moniker range="azure-devops"

You can use Azure DevOps CLI to delete an Azure DevOps Git repository.

az repos delete --id
                     [--detect {false, true}]
                     [--org]
                     [--project]
                     [--subscription]
                     [--yes] 

Parameters

Parameter Description
id ID of the repository. You can get the repository ID by running az repos list.
detect Automatically detect organization. Accepted values: false, true.
org, organization Azure DevOps organization URL. You can configure the default organization by using az devops configure -d organization=<ORG_URL>. Required if not configured as default or picked up via git config. Example: https://dev.azure.com/MyOrganizationName/.
project, p Name or ID of the project. You can configure the default project using az devops configure -d project=<NAME_OR_ID>. Required if not configured as default or picked up via git config.
subscription Name or ID of subscription. You can configure the default subscription using az account set -s <NAME_OR_ID>.
yes Don't prompt for confirmation.

Example

The following command deletes the Fabrikam repository, ID 0d58f562-4a10-495d-94d7-7ac61a22d7cc. This example uses the following default configuration: az devops configure --defaults organization=https://dev.azure.com/fabrikamprime project="Fabrikam Fiber".

az repos delete --id  0d58f562-4a10-495d-94d7-7ac61a22d7cc
Are you sure you want to delete this repository? (y/n): y

::: moniker-end

::: moniker range="< azure-devops" [!INCLUDE temp] ::: moniker-end