如何添加一个企业证书颁发机构(CA)与git上

问题描述:

当使用git在Cygwin获取你的cygwin(和一些Linux发行版):如何添加一个企业证书颁发机构(CA)与git上

Fetching origin 
fatal: unable to access 'https://.../...git': SSL certificate problem: self signed certificate in certificate chain 
error: Could not fetch origin 

证书添加到/etc/ssl/certs/ca-bundle.crtother bundle files,但下一个Cygwin更新问题再次出现。

git-remote-https将阅读下列文件CA证书:

/etc/ssl/certs/ca-bundle.crt 
/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt 

如果您编辑这些文件,他们将每个Cygwin的安装运行时覆盖,并没有为​​3210包的更新。

正确/合适的解决方案是将证书添加到拿起目录并运行皮卡脚本,更新-CA-信任:

curl -sL http://ca.pdinc.us > /etc/pki/ca-trust/source/anchors/ca.pdinc.us.pem \ 
&& update-ca-trust 

安装后的脚本的CA证书包将自动在每次升级时重新运行update-ca-trust脚本。欲了解更多信息:

man update-ca-trust 
+0

curl -sL命令应该做什么?它是http URL,显然不能获得上下文所期望的证书链。 – 2017-01-18 15:31:35

+0

在当前版本中,'git-remote-https'从'/ mingw64/ssl/certs/ca-bundle.crt'中读取证书,因为它是在'/ c/ProgramData/Git/config'中配置的。 '/ mingw64/bin/update-ca-trust'和'/ usr/bin/update-ca-trust'都不会更新该文件,因此脚本无用。我还没有找到哪个。 – 2017-01-20 07:16:40

+0

@JanHudec截至今天的更新,自2014年以来似乎并未如此。什么git - 版本(git版本2.8.3)和uname -a(CYGWIN_NT-6.1-WOW black7 2.6.1(0.305/5/3)2016-12-16 11:50 i686 Cygwin)你在吗? – 2017-01-24 00:34:49