Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Azure DevOps Services | Azure DevOps Server | Azure DevOps Server 2022
If a user accidentally deletes a provisioned (project) or published (code) wiki, you can restore it. Although the UI doesn't provide options to delete a wiki, users might use the REST API to delete the Git repository associated with the wiki.
Note
Deleted repositories stay in the recycle bin for 30 days. After 30 days, they're permanently deleted and can't be restored.
Prerequisites
| Category | Requirements |
|---|---|
| Project access | Member of the project where the wiki is located. If you don't have access, request it from your project administrator. Anyone with access to the team project can view the wiki, including Stakeholders. |
| Permissions | - To add or edit wiki pages: Member of the Contributors group. - To publish code as wiki: Create Repository permission. By default, members of the Project Administrators group have this permission. |
| Access levels | At least Basic access. |
Restore a complete wiki
Azure DevOps stores both project and code wikis as repositories in your project. To restore a complete wiki, use the REST API and follow these steps:
Retrieve Git repositories: List repositories.
Use the
includeHidden=trueparameter to see the wiki repositories.GET https://dev.azure.com/christiechurch/fabrikamfiber/_apis/git/repositories?includeHidden=true&api-version=7.1-preview.1{ "id": "978e3886-64a8-4b6f-96da-6afc2936b04b", "name": "fabrikamfiber.wiki", "url": https://dev.azure.com/christiechurch/052a83ac-af70-4194-b53f-df073e5f1786/_apis/git/repositories/978e3886-64a8-4b6f-96da-6afc2936b04b, "project": { "id": "052a83ac-af70-4194-b53f-df073e5f1786", "name": "fabrikamfiber", "url": https://dev.azure.com/christiechurch/_apis/projects/052a83ac-af70-4194-b53f-df073e5f1786, "state": "wellFormed", "revision": 421800049, "visibility": "organization", "lastUpdateTime": "2023-07-18T12:25:29.3Z" }, "defaultBranch": "refs/heads/wikiMaster", "size": 193, "remoteUrl": https://christiechurch@dev.azure.com/christiechurch/fabrikamfiber/_git/fabrikamfiber.wiki, "sshUrl": git@ssh.dev.azure.com:v3/christiechurch/fabrikamfiber/fabrikamfiber.wiki, "webUrl": https://dev.azure.com/christiechurch/fabrikamfiber/_git/fabrikamfiber.wiki, "isDisabled": false, "isInMaintenance": false }Search the recycle bin for your repository.
GET https://dev.azure.com/christiechurch/fabrikamfiber/_apis/git/recycleBin/repositories?api-version=7.1-preview.1When you find your repository, often named
.wiki, take note of the repo ID.{ "value": [ { "id": "978e3886-64a8-4b6f-96da-6afc2936b04b", "name": "fabrikamfiber.wiki", "project": { "id": "052a83ac-af70-4194-b53f-df073e5f1786", "name": "fabrikamfiber", "url": https://dev.azure.com/christiechurch/_apis/projects/052a83ac-af70-4194-b53f-df073e5f1786, "state": "wellFormed", "revision": 421800049, "visibility": "organization", "lastUpdateTime": "2023-07-18T12:25:29.3Z" }, "deletedBy": { "displayName": "Christie Church", "url": https://spsprodeus23.vssps.visualstudio.com/A1df9d653-bdfb-459b-a0c7-725052b2f944/_apis/Identities/0a0a4b55-9671-440d-87bf-26644f200d8a, "_links": { "avatar": { "href": https://dev.azure.com/christiechurch/_apis/GraphProfile/MemberAvatars/aad.MDY4MDk2OGQtYWU5OS03Y2M5LTgxZTEtNTBjMDk4ZTllZTlh } }, "id": "0a0a4b55-9671-440d-87bf-26644f200d8a", "uniqueName": christiechurch@fabrikam.com, "imageUrl": https://dev.azure.com/christiechurch/_api/_common/identityImage?id=0a0a4b55-9671-440d-87bf-26644f200d8a, "descriptor": "aad.MDY4MDk2OGQtYWU5OS03Y2M5LTgxZTEtNTBjMDk4ZTllZTlh" }, "createdDate": "2023-07-18T12:23:55.64Z", "deletedDate": "2023-07-18T12:41:38.737Z" } ], "count": 1 }Restore the wiki from the repository recycle bin.
PATCH https://dev.azure.com/christiechurch/fabrikamfiber/_apis/git/recycleBin/repositories/978e3886-64a8-4b6f-96da-6afc2936b04b?api-version=7.1-preview.1{ "deleted": false }
The repository contents restore. If the wiki UI doesn't reappear automatically, publish the restored repo as a wiki or create a wiki through the Wiki REST API to re-register it with the project.
Restore a wiki page
Go to the URL for your repo:
https://dev.azure.com/<OrgName>/<ProjectName>/_git/classicreleaseoption.wiki.Search the history for the main branch,
wikiMain.Find and select the commit that has the deleted files.
Select
More actions, and then select Revert.Create and complete a pull request.
The portal restores your wiki page.
Restore a wiki page with CLI
If you prefer command line options, follow these steps.
- Clone the wiki to your local machine.
- Search for the commit that deleted the page.
- Check out the commit.
- Copy the page to make a new commit.
Your wiki page is restored.
Delete a repository
DELETE https://dev.azure.com/christiechurch/fabrikamfiber/_apis/git/repositories/052a83ac-af70-4194-b53f-df073e5f1786?api-version=7.1-preview.1
Reassociate a restored wiki
The recycle bin restore recovers the Git repository (wiki pages and history) but doesn't always re-create the wiki registration or the file name association in the UI.
If the wiki doesn't appear after you restore the repo, you have two options:
Option 1: Republish through UI
- Go to Overview > Wiki in your project.
- If no wiki appears, select Publish code as wiki.
- Select the restored repository and branch (usually
wikiMaster). - Provide a wiki name and folder path if needed.
- Select Publish.
For detailed steps, see Publish a Git repository to a wiki.
Option 2: Recreate wiki registration with REST API
Create a new wiki by using the Wikis - Create REST API:
POST https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis?api-version=7.1-preview.2Request body:
{ "type": "codeWiki", "name": "Fabrikam Fiber Wiki", "projectId": "052a83ac-af70-4194-b53f-df073e5f1786", "repositoryId": "978e3886-64a8-4b6f-96da-6afc2936b04b", "mappedPath": "/", "version": { "version": "wikiMaster" } }Replace the following values:
{organization}: Your Azure DevOps organization name{project}: Your project name or IDname: Display name for the wikiprojectId: Project ID from step 2repositoryId: Repository ID from step 2mappedPath: Root folder path (usually/)version: Branch name (usuallywikiMaster)
Verify the wiki registration by listing wikis using the Wikis - List REST API:
GET https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis?api-version=7.1-preview.2
Known behavior: Page IDs after restoration
When you restore and republish or re-register a complete wiki, Azure DevOps recovers the wiki content but regenerates the internal page identifiers (Page IDs). Links that reference the original Page IDs might no longer resolve after restoration.
For example, a page URL before deletion might be:
https://dev.azure.com/organization/project/_wiki/wikis/wiki/424/page-name
After restoration, the URL for the same page might be:
https://dev.azure.com/organization/project/_wiki/wikis/wiki/3815/page-name
In this example, the page name remains the same, but the Page ID changes from 424 to 3815. As a result:
- Direct links that depend on the original Page ID can become invalid.
- Bookmarks, external references, and integrations that store Page ID-based URLs might need to be updated.
- Path-based links continue to work if the wiki structure and page paths remain unchanged.
This behavior is expected because Azure DevOps creates new Page IDs when it restores the wiki registration. The original wiki's Page IDs aren't preserved.
Post-restoration verification
After using either option:
- Confirm that the repo and branches exist in your project in Repos.
- Verify the wiki appears in your project under Overview > Wiki.
- Check permissions, links, and any widgets that referenced the old wiki.
Note
- The recycle bin and some wiki registration APIs are in preview and can change. Test in a nonproduction organization and use the api-version documented for your environment.
- For project wikis (provisioned wikis), use
type: "projectWiki"instead of"codeWiki"in the REST API call and omit therepositoryIdandmappedPathproperties.