如何在TFS 2015中删除Git仓库以切换至TFVC
How to Remove an Empty Git Repository from a TFS 2015+ Project
Got it, let's break down exactly how to get rid of that empty Git repo so it stops showing up in your TFS Web UI and Visual Studio. First, a quick note: you'll need Project Administrator permissions to do this—if you don't have that, reach out to your team's TFS admin first.
Step-by-Step via TFS Web UI
This is the easiest method for most teams:
- Log into your TFS Web portal and navigate to the project where the empty Git repo lives.
- Click the Settings gear icon in the top-right corner (or look for "Project Settings" in the project's main menu).
- In the settings sidebar, find and select Repos (or "Version Control"—labeling might vary slightly depending on your exact TFS 2015 Update version).
- You'll see a list of all repositories linked to the project, including both Git and TFVC. Locate the empty Git repo you want to remove.
- Click the three-dot menu (⋮) next to the repo name, then select Delete.
- Confirm the deletion in the pop-up window. Since the repo is empty, you won't get a warning about lost data—just hit "Delete" to finish.
Verify the Removal
After deleting, head over to Visual Studio:
- Open the Team Explorer pane, connect to your TFS project, and click the Sync or Repos section.
- Click the refresh icon at the top of the pane—the empty Git repo should no longer appear in the list of available repositories.
Alternative: Using TFS REST API (If Web UI Isn't Working)
If for some reason the Web UI doesn't show the delete option, you can use the TFS REST API:
- First, get the ID of your empty Git repo by sending a GET request:
Look for the repo with an empty commit history to grab itsGET http://<your-tfs-server>:8080/tfs/<collection-name>/<project-name>/_apis/git/repositories?api-version=1.0idvalue. - Send a DELETE request to remove it:
DELETE http://<your-tfs-server>:8080/tfs/<collection-name>/<project-name>/_apis/git/repositories/<repo-id>?api-version=1.0
Just remember: once deleted, the Git repo can't be recovered—but since it's empty, that's not a concern here.
内容的提问来源于stack exchange,提问作者Pat Delaney
相关产品推荐
相关产品推荐

