72

I was adding a new Solution to TFS in Visual Studio 2013, and I selected Git as opposed to TFS.

I want to remove the Git binding, and add TFS.

I know you can remove TFS binding from File -> Source Control, but this doesn't seem to be an option here.

How can I remove Git binding from a Visual Studio solution, and add TFS?

Thanks

JMK
  • 27,273
  • 52
  • 163
  • 280

4 Answers4

143

I don't believe Visual Studio adds anything special for git integration. It just looks for the presence of the .git directory in the solution folder. Delete that folder, possibly hidden, and Visual Studio will no longer consider it a git project.

Appulus
  • 18,630
  • 11
  • 38
  • 46
JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
  • Thanks! I was struggling with an old .git in my Windows\Users folder that kept showing up in my VS2013 when it did not in VS2012. Removing the .git folder took it out of my project so I could save it to TFS, now known as Visual Studio Online. I kept getting an Unknown error from git2lib. – bizcad Jan 20 '14 at 23:31
  • 12
    Note this is not a valid solution for those of us that do indeed work out of a git repository but do not wish to use Visual Studio's git features. I use the command line shell for git, I do not want those bloat features in VS when I don't use them. – void.pointer Dec 31 '14 at 15:38
  • @void.pointer recommend using notepad or an editor that lacks git support, or removing the git feature from visual studio – fabspro Jun 22 '16 at 10:20
18

snippet for git dir

As @JaredPar mentioned, if you delete the highlighted directories and reload the solution then the solution would no longer be under source control.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
themasterchief
  • 361
  • 1
  • 4
  • 9
  • 4
    the .git folder could only appear after you select the option "Show hidden folders" in Windows Explorer, while the two other files always appeared – Michael Bahig Aug 22 '16 at 09:41
  • Many times projects are added automatically to the GIT. It always happens when the VS can not connect to TFS for some reason. It should not be like that. Now I know how to delete the project with Git. Thank you. – Piotr Knut Oct 28 '16 at 18:44
7
  1. Go to Quick Launch(Ctrl+Q)
  2. Search for "Source"
  3. Select the following option Select the option from List

  4. Select the Dropdown list enter image description here

  5. Choose your source control from list and click "ok" enter image description here

guntbert
  • 536
  • 6
  • 19
  • The solution does not really work. I have selected TFS. If there is a problem with connection to TFS, Visual Studio automatically adds the GIT, when you try to add the solution to the repository. It should not be like that. Git plugin should ask the user to if he wants to do it. – Piotr Knut Oct 28 '16 at 18:39
  • This Don't Work. If we change the Source control plugin, VS asks to close the project to proceed. – Gurusinghe Jan 04 '17 at 02:27
  • @gurusinghe Which Edition of Visual Studio you are using? – Sivanantham Padikkasu Jan 04 '17 at 06:07
6

Just as a side note. If you by accident create a Git repository in a parent folder of a project under TFS, Visual Studio will use Git as source control for that project too.

Mikael Gyth
  • 427
  • 3
  • 16
  • 1
    Thanks, I mistakenly made a local git repo for my entire solution. suddenly everything disappeared. Very disconcerting! You're comment gave the the 'ah ha!' I needed. I deleted the .git folder in the top level directory and everything's back. Thanks again! – Weej Nov 03 '15 at 21:50