我有一个公司的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的拉取的情况下,使从企业服务器的拉取工作?
发布于 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发行版。
发布于 2015-10-08 21:03:32
从Git for Windows v2.5.0开始,已安装的证书文件已移至C:\Program Files (x86)\Git\mingw32\ssl\certs\ca-bundle.crt
。您必须将证书添加到此文件中。
https://stackoverflow.com/questions/23807313
复制相似问题