git 在 Visual Studio 中更改源代码管理插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16249595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:28:42  来源:igfitidea点击:

Change source control plug-in in Visual Studio

gitsvnvisual-studio-2012ankhsvn

提问by Johan Larsson

Currently the solution is managed by SVN and I want to switch to git. When I do Tools->Options->Source Control->Plug-in Selection and change plug-in I get this dialog:

目前该解决方案由 SVN 管理,我想切换到 git。当我执行 Tools->Options->Source Control->Plug-in Selection 并更改插件时,我得到以下对话框:

enter image description here

在此处输入图片说明

I never get past that, when I open the .sln again it is still SVN.

我从来没有忘记,当我再次打开 .sln 时,它仍然是 SVN。

I have a feeling I have done this many times in the past.

我有一种感觉,我过去曾多次这样做过。

Additional info: The files are already managed by git, I just cloned it using git extensions and it was np. The issue is in VS.

附加信息:这些文件已经由 git 管理,我只是使用 git 扩展名克隆了它,它是 np. 问题出在 VS 中。

回答by Vilx-

Suggestion: Don't bother with switching. Remove it from source control (SVN) and check it in anew (git). Or, if removing it by Visual Studio tools doesn't work, here's how you do it manually:

建议:不要打扰切换。从源代码管理 (SVN) 中删除它并重新检查它 (git)。或者,如果通过 Visual Studio 工具删除它不起作用,请按照以下方法手动执行此操作:

  1. Close Visual Studio;
  2. Delete the .svn folder
  3. Open the .SLN file in notepad, find the lines which specify the SCC provider, and delete them.
  4. Open the solution in Visual Studio again - it should not be under source control anymore and you should be able to check it in git.
  1. 关闭 Visual Studio;
  2. 删除 .svn 文件夹
  3. 在记事本中打开.SLN 文件,找到指定SCC 提供程序的行,然后将其删除。
  4. 再次在 Visual Studio 中打开解决方案 - 它不应再受源代码控制,您应该能够在 git 中检查它。

Edit: Manually removing this from the .sln file did the trick:

编辑:从 .sln 文件中手动删除它可以解决问题:

GlobalSection(SubversionScc) = preSolution
    Svn-Managed = True
    Manager = AnkhSVN - Subversion Support for Visual Studio
EndGlobalSection

回答by JotaBe

The easier way to do it is a two steps process which can be done withput leaving Visual Studio:

更简单的方法是两个步骤的过程,可以在不离开 Visual Studio 的情况下完成:

  1. Open the menu option File > Subversion > Change Source Control. In the dialog use the Disconnect button.

  2. As described in the question itself, open the menu Tools > Options, and change the Source Control to git. This time it will change it without complaining at all.

  1. 打开菜单选项 File > Subversion > Change Source Control。在对话框中使用断开连接按钮。

  2. 如问题本身所述,打开菜单工具 > 选项,并将源代码管理更改为 git。这一次它会毫无怨言地改变它。

回答by JotaBe

What actually helped me, I could not find in my Asp.net coresolution folder any svnfile or .git, but it was in C:\Users\NAME, deleted there .gitfile, it was HIDDEN. Then in vs automatically source control changed from gitto TFVS. however it somehow created in my solution folder gitfiles, deleted once more and it started to work fine.

什么是真正帮助了我,我不能在我找到Asp.net core解决方案文件夹的任何svn文件或.git,但它是C:\Users\NAME,删除有.git文件,它是HIDDEN。然后在 vs 中自动将源代码管理从 更改gitTFVS. 但是它以某种方式在我的解决方案文件夹git文件中创建,再次删除并开始正常工作。

回答by Bert Huijben

The proper way to remove these settings for SCC providers is File -> Source Control -> Change Source Control. Where AnkhSVN calls the 'Source Control' menu 'Subversion'.

为 SCC 提供程序删除这些设置的正确方法是文件 -> 源代码管理 -> 更改源代码管理。AnkhSVN 将“源代码管理”菜单称为“Subversion”。

This trick should work for all well behaved SCC providers (VSS, TFS, AnkhSVN, etc. etc.)

这个技巧应该适用于所有表现良好的 SCC 提供者(VSS、TFS、AnkhSVN 等)