首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >添加自签名SSL证书而不禁用颁发机构签名的证书

添加自签名SSL证书而不禁用颁发机构签名的证书
EN

Stack Overflow用户
提问于 2014-05-22 20:50:10
回答 2查看 44.4K关注 0票数 37

我有一个公司的git服务器,使用自签名证书通过https工作。本地克隆包含两个远程-源指向该服务器,另一个指向github。默认情况下,从原点拉取失败:

$ git pull
fatal: unable to access 'https://user@code.example.com/git/fizzbuzz.git/': SSL certificate problem: self signed certificate

github遥控器工作正常。

有两个经常被建议的解决方案:

git config http.sslVerify false

这是一个糟糕的想法,也是在configure Git to accept a particular self-signed server certificate for a particular https remote上建议的

git config http.sslCAInfo <downloaded certificate>.pem

它修复了从原点拉取,但破坏了github遥控器:

$ git pull github
fatal: unable to access 'https://github.com/user/fizzbuzz.git/': SSL certificate problem: unable to get local issuer certificate

如何在不中断从github的拉取的情况下,使从企业服务器的拉取工作?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-05-22 20:54:35

如果你使用的是Git 1.8.5+ (2013年8月),你可以使用specify http directives per URL(!)

在您的案例中:

git config --global http."https://code.example.com/".sslVerify false
#
# or, if not on default 443 port:
#
git config --global http."https://code.example.com:<aPort>/".sslVerify false

这将仅禁用code.example.com的SSL验证,而不是其他URL的验证。

或者:

git config --global http."https://code.example.com/".sslCAInfo <downloaded certificate>.pem

同样的想法:对于code.example.com URL,sslCAInfo将只指向<downloaded certificate>.pem

可以将您的证书添加到Git系统证书存储库中,如果使用git-for-windows,它将位于C:\path\to\PortableGit-2.6.1-64-bit\usr\ssl\certs\ca-bundle.crt中。

不过,这并不是最佳实践,除非您必须分发一个包含内部证书的Git发行版。

票数 70
EN

Stack Overflow用户

发布于 2015-10-08 21:03:32

Git for Windows v2.5.0开始,已安装的证书文件已移至C:\Program Files (x86)\Git\mingw32\ssl\certs\ca-bundle.crt。您必须将证书添加到此文件中。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23807313

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档