Restoring a Deleted repository in Azure DevOps

Though there are no direct ways to restore a deleted repository in Azure DevOps, By using Azure DevOps REST API it is possible to restore a deleted repository as the deleted repositories go into a soft delete state before they become permanently deleted.Let us see how to recover a deleted repository from recycle bin using Azure DevOps REST API in the following steps

Step 1: Go to https://app.boomerangapi.com/workspace (RESTAPI tool like Postman)

Step 2: Get the list of deleted repositories as shown below using Boomerang (you can also get the list of repositories also by browser using the below api – https://dev.azure.com/{Orgname}|/{ProjectName}/_apis/git/recycleBin/repositories/

Step 3: Let us restore the SmartMobile App via API. Take the Repository ID of the repo and then do a patch request as shown below

Step 4: Get the list of deleted repositories as shown below using Boomerang (you can also get the list of repositories also by browser using the below api –

API url : https://dev.azure.com/{Orgname}|/{ProjectName}/_apis/git/recycleBin/repositories/{RepositoryID}

And pass the below request

{
    "deleted":false
}

Once the requested is executed successfully, the repository would be successfully restored back.

You can also see the restored repository in the list of Repositories as shown below in the Azure DevOps portal also.This can be done only through Azure DevOps API and there is no other way for it.

You may also like...