title | titleSuffix | description | ms.assetid | ms.technology | ms.topic | monikerRange | ms.date |
---|---|---|---|---|---|---|---|
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 |
devops-code-git |
conceptual |
<= azure-devops |
02/23/2022 |
[!INCLUDE version-lt-eq-azure-devops] [!INCLUDE version-vs-gt-2015]
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.
[!VIDEO https://www.microsoft.com/en-us/videoplayer/embed/RE4sVSK]
- To rename a repository, you must have Rename Repository permissions on your Git repo. ::: moniker range=">= azure-devops-2020"
- If you want to use az repos update command to rename a repository, be sure to follow the steps in Get started with Azure DevOps CLI. ::: moniker-end
::: moniker range=">= azure-devops-2019"
-
From the web portal, select Repos, Files.
-
From the repo drop-down, select Manage repositories.
-
Select the name of the repository from the Repositories list, choose the ... menu, and then choose Rename repository.
-
Rename the repository by typing the repo's new name and selecting Rename.
::: moniker-end
::: moniker range="tfs-2018"
-
- From the web portal, open the project administration page for your project and select Version Control.
-
Select the repo you want to rename under Git repositories on the left and select .... Select Rename repository... from the menu.
[!NOTE] If the Repositories pane is not expanded, select > to expand it and display the list of repositories.
-
Enter a new repo name in the Repository name field in the dialog, then select Rename.
::: moniker-end
::: moniker range="azure-devops" [!INCLUDE az-repos-update]
::: moniker-end
[!INCLUDE temp]
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.
::: moniker range=">= azure-devops-2019"
-
Select Repos, Files.
-
Select Clone in the upper-right corner of the Files window and copy the clone URL.
::: moniker-end
::: moniker range="tfs-2018"
::: moniker-end
-
Connect to the repo.
-
Open the project settings.
-
Open the repo settings.
-
Edit the fetch and push remote references and paste the URL that you copied from the remote repo.
If you use an older version of Visual Studio or work with Git from the command prompt:
-
Open the Git command prompt.
-
Go to the local repository and update the remote to the URL you copied from the remote repo.
git remote set-url origin {URL_you_copied_from_the_remote_repo}
A: Yes
A: If you're using:
-
Visual Studio 2015, then edit the remote with the name you used.
-
An older version of Visual Studio or the command prompt, then run this command:
git remote set-url {remote_name} {URL_you_copied_from_the_remote_repo}