我有一个使用自签名证书通过https工作的企业git服务器.本地克隆包含两个遥控器 - 指向该服务器的原点,另一个指向github.默认情况下从原点拉出失败:
$ git pull
fatal: unable to access 'https://user@code.example.com/git/fizzbuzz.git/': SSL certificate problem: self signed certificate
Run Code Online (Sandbox Code Playgroud)
github遥控器工作正常.
有两种经常建议的解决方案:
git config http.sslVerify false
Run Code Online (Sandbox Code Playgroud)
这是一个坏主意,并且在配置Git中建议接受特定https远程的特定自签名服务器证书:
git config http.sslCAInfo <downloaded certificate>.pem
Run Code Online (Sandbox Code Playgroud)
修复了从原点拉动,但打破了github远程:
$ git pull github
fatal: unable to access 'https://github.com/user/fizzbuzz.git/': SSL certificate problem: unable to get local issuer certificate
Run Code Online (Sandbox Code Playgroud)
如何在不破坏github的情况下从公司服务器上工作?
Von*_*onC 54
如果您使用的是git 1.8.5 +(2013年8月),则可以为每个URL(!)指定http指令.
在你的情况下:
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
Run Code Online (Sandbox Code Playgroud)
这将取消ssl验证,仅针对code.example.comurl,而不针对其他针对url.
要么:
git config --global http."https://code.example.com/".sslCAInfo <downloaded certificate>.pem
Run Code Online (Sandbox Code Playgroud)
同样的想法:仅sslCAInfo指向网址.<downloaded certificate>.pemcode.example.com
它可以添加您的证书在GIT系统证书存储区,它与混帐的窗口,在C:\path\to\PortableGit-2.6.1-64-bit\usr\ssl\certs\ca-bundle.crt.
但这不是最好的做法,除非您必须在其中分发带有内部证书的git发行版.
从适用于Windows 的 Git v2.5.0 开始,安装的证书文件已移至C:\Program Files (x86)\Git\mingw32\ssl\certs\ca-bundle.crt. 您必须将您的证书添加到此文件中。
| 归档时间: |
|
| 查看次数: |
31368 次 |
| 最近记录: |