You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在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:

  1. First, get the ID of your empty Git repo by sending a GET request:
    GET http://<your-tfs-server>:8080/tfs/<collection-name>/<project-name>/_apis/git/repositories?api-version=1.0
    
    Look for the repo with an empty commit history to grab its id value.
  2. 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 10:11:30