Disable git in Visual Studio 2013

假如想象 提交于 2019-12-03 06:57:46

问题


I have a repository that is managed by tfs. However locally I would like to manage it via git and the push changes to tfs. Once I'm creating git repo over there VS2013 in team explorer shows this solution managed by git only. If I try to edit any file it complains that file is read only only I cannot save it in a previous version. So my question is there any way for Visual Studio 2013 to forget about git at all and manage it as tfs repository. I can manage git from command line. Or is there a way to make it to checkout files from tfs repo when I'm doing a changes?


回答1:


For your scenario Git-tf is probably a better solution, it will create a local git repo based on your TFVC source control folder. When you're done, you can push your changes from Git directly to TFVC from the commandline. Since you're already comfortable on the commandline, that might work out pretty well for you.

It's very hard to force Visual Studio to currently stay on Team Foundation Source Control when there is a git repo in the same folder.


As a horrible workaround, close your solution, rename the .git folder to _git and reload the solution. This should bring TFVC back, but if it doesn't, then rebind the solution to TFVC if using file->source control->advanced->Change Source Control. Then after checking in, close the solution again, rename _git back to .git and reload.


As Ed mentions in the comments, you can move your .git folder to another folder, like this:

 \MyProjects
    \GitRoot
     |  \.git
     \MySolution
      \MyFirstProject
      \MySecondProject

This allows Visual Studio to use the TFVC bindings and you can tell the git commandline that the .git directory is elsewhere using the git --git-dir=\MyProjects\GitRoot\.git command argument.

You can set an environment variable named GIT_DIR to fix that in one go, as @hlovdal mentions.


And there is another trick that @Eric mentions which creates a text file names .git that has the following in it:

gitdir: _git

Rename .git folder to _git, then make sure you add _git to .gitignore

Tip: to create a file that starts with a . from Windows Explorer you can use the New/Text Document option:

Then name the file .git. (make sure the Show file Extensions option is ticked):




回答2:


The solution outlined here works well for me: How can you disable Git integration in Visual Studio 2013 permanently?

Essentially:

  • Rename .git folder to _git, as @jessehouwing says
  • Create a text file called .git containing just the line "gitdir: /Path/To/_git"
  • Add _git to .gitignore

Visual Studio will now only use TFS and git works properly as well.




回答3:


I suggest theses steps :

  1. Go to TOOLS Tab in Visual Studio
  2. Select Options items
  3. On the left, select Source Control
  4. In the Plugin Selection Item, Enter None in the dropdownlist associated




回答4:


You can remove the git support from Visual Studio 2013 using some registry hacks. It's of course a bit risky, but I've yet to have any problems after removing git support using this method:

http://blog.markrendle.net/disable-the-git-source-control-add-in-in-vs2013-permanently/

It boils down to just removing everyhing associated with the GUID {11B8E6D7-C08B-4385-B321-321078CDD1F8}




回答5:


Bad Solution: Close your solution, rename the .git folder to _git and reload the solution worked for me. Thanks jessehouwing.



来源:https://stackoverflow.com/questions/20101211/disable-git-in-visual-studio-2013

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!