Skip to content

Latest commit

 

History

History
142 lines (74 loc) · 4.8 KB

repo-rename.md

File metadata and controls

142 lines (74 loc) · 4.8 KB
title titleSuffix description ms.assetid ms.service ms.topic monikerRange ms.date ms.subservice
Rename a Git repo in your project
Azure Repos
You can rename a Git repository in a few steps. Your team will have to take a few more steps to adapt to the change.
05971618-4ea9-4997-bb51-2d74211352ef
azure-devops-repos
conceptual
<= azure-devops
02/23/2022
azure-devops-repos-git

Rename a Git repository in your project

[!INCLUDE version-lt-eq-azure-devops] [!INCLUDE version-vs-gt-eq-2019]

You can rename a Git repository in a project from your web browser. After you rename the repo, each member of your team should take a few steps to re-enable their dev machines to connect to the repo on the server.

Prerequisites

Rename the repository

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

  1. From the web portal, select Repos, Files.

    View your files

  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 Rename repository.

    Rename repository

  4. Rename the repository by typing the repo's new name and selecting Rename.

    Rename repository confirm

::: moniker-end

::: moniker range="azure-devops" [!INCLUDE az-repos-update]

::: moniker-end

[!INCLUDE temp]


Update the Git remotes on your dev machines

Git uses remote references to fetch and push changes between your local copy of a repository and the remote version that is stored on the server. After a Git repository or project has been renamed, you should update your remote references. Update your references to that the remote repository URL contains the project and the repository name.

Each member of your team must update their local Git repos to continue connecting from their dev machines to the repo in the project. The instructions below show how to update the remotes for the Fabrikam Mobile repo that was renamed to Fabrikam.

Get the new URL for the repo

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

  1. Select Repos, Files.

    View your files

  2. Select Clone in the upper-right corner of the Files window and copy the clone URL.

    Retrieve the clone URL

::: moniker-end

Update your remote in Visual Studio

To update your remote:

  1. In the Git menu from the menu bar, select Manage Remotes.

  2. In the Options dialog, select the remote to edit, then select Edit.

    :::image type="content" source="media/repo-rename/options-rename-remote.png" border="true" alt-text="Screenshot shows the Options dialog with the option to edit remotes." :::

  3. Replace the fetch and push remote references with the URL that you copied from the remote repo.

  4. Select Save and then OK to close the Options dialog.

Visual Studio 2019 version 16.8 and later versions provides a Git version control experience while maintaining the Team Explorer Git user interface. To use Team Explorer, uncheck Tools > Options > Preview Features > New Git user experience from the menu bar. You can exercise Git features from either interface interchangeably.

To update your remote from Visual Studio Team Explorer:

  1. Connect to the repo.

    Connect to the repository

  2. Open the project settings.

    Project settings

  3. Open the repo settings.

    Repository settings

  4. Edit the fetch and push remote references and paste the URL that you copied from the remote repo.

    Edit remote

Q&A

Q: Can I rename my repo again? Can I reuse an old repo name?

A: Yes

Related articles