配置Visual Studio以使用系统安装的Git.exe [英] Configure Visual Studio to use system-installed Git.exe

查看:126
本文介绍了配置Visual Studio以使用系统安装的Git.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2017附带了自己的Git版本.不幸的是,它不支持SSH 也没有为颁发者提供根证书,以保护我们的存储库的SSL证书.因此,每当我们尝试克隆,拉动或推入时,都会出现此错误:

Visual Studio 2017 ships with its own version of Git. Unfortunately, it doesn't have support for SSH and it doesn't include a root certificate for the issuer for SSL certificate protecting our repositories. So, whenever we try to clone, pull, or push, we get this error:

克隆远程存储库时遇到错误:Git失败并出现致命错误. 致命:无法访问"https://********/":SSL证书问题:无法获取本地发行者证书

Error encountered while cloning the remote repository: Git failed with a fatal error. fatal: unable to access 'https://********/': SSL certificate problem: unable to get local issuer certificate

看起来Visual Studio 2017附带了自己的Git版本. Git的最新版本2.12.2通过添加对验证SSL证书时在Windows证书存储区中查找的支持,解决了上述问题. 总有办法将Visual Studio配置为使用全局安装的Git版本吗?如果解决方案可以在Visual Studio的各个版本之间使用,则可以得到加分.

It looks like Visual Studio 2017 ships with its own version of Git. The latest version of Git, 2.12.2, fixes the issue above by adding support for looking in the Windows Certificate stores when validating SSL certificates. Is there anyway to configure Visual Studio to use the globally installed version of Git? Bonus points if the solution works across versions of Visual Studio.

推荐答案

这可能会有点晚,但是以防万一其他人正在寻找此信息并在此处结束,您可以告诉Visual Studio 2017/2019使用通过执行以下操作来安装Git的系统版本:

This may be a little bit late but just in case others come looking for this information and end up here, you can tell Visual Studio 2017/2019 to use the system installed version of Git by doing the following:

  1. 打开Visual Studio,单击顶部的工具"菜单项.
  2. 选择列表底部的选项.
  3. 在Visual Studio选项的搜索框中搜索Git
  4. 在外部Web工具"部分下,找到包含以下内容的两个条目:$(DevEnDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd $(DevEnDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin
  1. Open up Visual Studio, click on the Tools menu item at the top.
  2. Select Options at the bottom of the list.
  3. In the search box for Visual Studio options search for Git
  4. Under the External Web Tools section, find the two entries that contain: $(DevEnDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd $(DevEnDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin

请注意,此截图是在Google上找到的,因为我没有计算机上的实际截图.因此可能看起来有些不同.

  1. 将其替换为系统安装的git版本的位置.

  1. Replace these with the location of your system installed version of git.

第五步示例如下:

C:\Program Files\Git\bin

C:\Program Files\Git\mingw64\bin

最后,您将需要完全关闭Visual Studio.为了安全起见,我建议您进行一次真正的重启,因为有时即使重新打开Visual Studio后也看不到那些更改.

Finally, you will need to completely close down Visual Studio. I would recommend an actual restart just to play it safe because sometimes it doesn't see those changes even after re-opening Visual Studio.

这篇关于配置Visual Studio以使用系统安装的Git.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆