我们在本地设置了新的TFS 2017服务器。我的系统管理员设置了https并生成了一个自签名证书。使用Visual Studio的内置git工具,一切正常。当我尝试从CLI执行任何操作时,出现以下错误:SSL certificate problem: unable to get local issuer certificate
我尝试过:
在我的客户端计算机上的受信任的根证书颁发机构存储中安装证书(它也安装在服务器上)。要安装它,我只需双击提供给我的.pfx文件,输入密码,然后选择受信任的根存储。
经过一些故障排除后,我将本地证书导出为Base-64编码的x.509(.CER)文件,并将其附加到ca-bundle.crt
仔细检查我的git配置,确保http.sslcainfo指向正确的ca-bundle.crt文件。
使用openssl连接到我的服务器。这给了我两个错误消息:
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 OU = Created by Team Foundation Server, CN = my.company.com
verify error:num=21:unable to verify the first certificate
verify return:1
Certificate chain
0 s:/OU=Created by Team Foundation Server/CN=my.company.com
i:/OU=Created by Team Foundation Server/CN=my.company.com
尝试使用其他计算机上的CLI通过https进行连接,结果相同。
更新
答案 0 :(得分:1)
您的问题似乎与TFS无关,但无法验证您的自签名证书。您可以查看解决方案here:
解决方法强>
告诉git不使用全局选项执行证书验证:
git config --global http.sslVerfiy false
解决方案
以前有几种方法可以解决此问题:
一个。确保根证书here将根证书添加到git.exe的证书库中。
B中。通过运行:
告诉Git在哪里找到CA包git config --system http.sslCAPath /absolute/path/to/git/certificates
或将CA捆绑包复制到/ bin目录并将以下内容添加到gitconfig文件中:
sslCAinfo = /bin/curl-ca-bundle.crt
℃。重新安装Git。
d。确保存在完整的CA,包括根证书。
解决SSL问题后,如果您在命令行中遇到身份验证问题,可以参考以下情况:
Using Git with TFS 2017 - Works in Visual studio but not Command Line
答案 1 :(得分:0)
最后,事实证明,IIS生成的证书就是问题。
我在这个问题上找到了解决方案: Unable to resolve "unable to get local issuer certificate" using git on Windows with self-signed certificate
请参阅使用makecert生成服务器证书的已接受答案