近期项目用到 git 管理项目,使用的 IDE 还是VS2017,遇到一个奇葩的事情,在团队项目中新增了我的开发账户,但在工作电脑中始终 Cloning 不了,始终报错:
[code]
Git failed with a fatal error.
Authentication failed for ‘http://host:port/tfs/xx/xx/_git/xx/’
[/code]
看错误信息,很明显是”认证失败“。
开始以为是账户权限设置的有问题,但在别的电脑上就可以正常克隆,就纳闷了……
一百度/谷歌,一大片“解决方法”,然而都没有什么卵用……主要还是问题没有找到关键原因,人家都可以解决,但不对我这个问题的症状呀~
总结一下,大致几种方法:
1、将 bin 的 libeay32.dll 和 ssleay32.dll 复制到了 git-core 的文件夹下
源目录: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin
目标目录: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\git-core
———————
云勇 :https://blog.csdn.net/xiaoyong_net/article/details/71123290
雲霏霏:https://www.cnblogs.com/yunfeifei/p/6686065.html?utm_source=itdadao&utm_medium=referral
2、清除 Windows 凭据
把对应的凭据删除,就可以了……
———————
前进的 HelloWorld :https://blog.csdn.net/qq_34665539/article/details/80408282
3、命令行处理
具体参看:https://www.cnblogs.com/gzbit-zxx/p/8126849.html
本人觉得用命令行操作,比较麻烦。。没有尝试~
4、清除系统缓存等
———————
https://developercommunity.visualstudio.com/content/problem/304224/git-failed-with-a-fatal-errorauthentication-failed.html
……
还有很多方法,就不一一列举了,本人很多都尝试过,但都没有解决问题……
无语……
最终,功夫不负有心人,找到一篇文章:https://www.cnblogs.com/autohome7390/p/9767429.html
尝试了一下,成功了!内牛满面中……
经过分析觉得应该是VS2017 没有配置为最新的Git,系统中存在旧版导致的? 带着这样的疑问去 google,不查不要紧,一查才发现了一个蛋疼的事实,vs2017 内置了一个阉割版的Git,路径在:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
在这个路径下存在一个Git 目录,我使用的是企业版,如果使用专业版或社区版的,请在对应版本的目录中找:
解决方案:
重命名VS2017 自带的 Git 文件夹为 Gitback,下载 64-bit Git for Windows Portable(下载地址),官网下载比较慢,我下了半天,可以在百度盘下载:
链接: https://pan.baidu.com/s/1XSaw7dGN9_xuMxpE7AZr2g
提取码: wi7e
解压后重命名文件夹为 Git,复制到
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
最后重启VS2017,再次 Cloning 成功!