git 特定服务器的 http.sslCAInfo 证书的正确 .gitconfig 语法是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23293417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the right .gitconfig syntax for http.sslCAInfo certificate for specific server?
提问by
I'm using a remote git repository via https, which has a self-signed certificate. To make git aware of the self-signed certificates, I have the following in my .gitconfig:
我正在通过 https 使用远程 git 存储库,它具有自签名证书。为了让 git 知道自签名证书,我的 .gitconfig 中有以下内容:
[http]
sslCAInfo = /home/user/myselfsigned.cert
This works fine, but when I add another remote with a CA signed certificate, git (or curl?) wrongly tries to use the cert file for this remote, too. What is the correct syntax to apply the certificate to a specific remote?
这工作正常,但是当我添加另一个带有 CA 签名证书的遥控器时,git(或 curl?)也错误地尝试使用该遥控器的证书文件。将证书应用于特定遥控器的正确语法是什么?
采纳答案by shtolik
I think that questionhas answer to your question as well:
我认为这个问题也可以回答你的问题:
git config http."https://code.example.com/".sslCAInfo <downloaded certificate>.pem
And gitconfig file will be smth like:
并且 gitconfig 文件将类似于:
[http "https://code.example.com/"]
sslCAinfo = /path/to/<downloaded certificate>
Although it doesn't work for me yet...
虽然它对我还不起作用......