没有 env GIT_SSL_NO_VERIFY=true 的 git ssl

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12537763/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 14:39:19  来源:igfitidea点击:

git ssl without env GIT_SSL_NO_VERIFY=true

gitnetbeansssl

提问by RaKoDev

? install my own git server in distant machine with ssl.

? 使用 ssl 在远程机器上安装我自己的 git 服务器。

whene i use this command:

当我使用此命令时:

env GIT_SSL_NO_VERIFY=true git clone https://xxx.xxx.xxx.xxx/git/project.git

env GIT_SSL_NO_VERIFY=true git clone https://xxx.xxx.xxx.xxx/git/project.git

all is fine, and with env GIT_SSL_NO_VERIFY=true all git command work fine.

一切都很好,并且使用 env GIT_SSL_NO_VERIFY=true 所有 git 命令都可以正常工作。

but i need pull and push with netbeans ide, so with netbeans ide i connot add this

但我需要用 netbeans ide 拉推,所以用 netbeans ide 我不能添加这个

env GIT_SSL_NO_VERIFY=true

环境 GIT_SSL_NO_VERIFY=true

so netbeans say:

所以网豆说:

Cannot?connect?to?the?remote?repository?at?https://xxx.xxx.xxx.xxx/git/project.git

不能?连接?到?远程?存储库?在?https://xxx.xxx.xxx.xxx/git/project.git

What i need to do?

我需要做什么?

回答by mpontillo

You could do this (from the git-configmanual page):

你可以这样做(从git-config手册页):

git config --global http.sslVerify false

But what's the point of having it on an https server if the certificate won't properly validate?

但是,如果证书无法正确验证,将它放在 https 服务器上有什么意义呢?

回答by zwol

If the https server uses a self-signed certificate, save it to your local machine's hard disk (in .crtformat), and add this to .git/configfor the relevant working copy

如果https服务器使用自签名证书,保存到本地机器硬盘(.crt格式),并添加到.git/config相关工作副本

[http]
        sslCAInfo=/path/to/your-server-certificate.crt

That will make it always expect that certificate when connecting to the https server in question, and not otherwise.

这将使它在连接到有问题的 https 服务器时总是期望该证书,而不是其他情况。

回答by Colin D Bennett

Agreed with other posters that GIT_SSL_NO_VERIFY or other means of preventing certificate verification is not the right solution. The best solution only takes a few seconds to implement, and is found in this answer: https://stackoverflow.com/a/8467406/994153It involves downloading the certificate .pemfile and setting the Git configuration variable http.sslCAinfoto point to the file.

同意其他海报,即 GIT_SSL_NO_VERIFY 或其他阻止证书验证的方法不是正确的解决方案。最好的解决方案只需几秒钟即可实现,可在此答案中找到:https: //stackoverflow.com/a/8467406/994153它涉及下载证书.pem文件并将 Git 配置变量设置http.sslCAinfo为指向该文件。