git clone https/ssl 错误

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

git clone https/ssl error

gitsslhttps

提问by user2164525

I have installed the ssl certificate and key in my git server. But am getting error when i try to clone via https from my mysysgit. Earlier it was working fine with http. Unable to identify where it is failing

我已经在我的 git 服务器中安装了 ssl 证书和密钥。但是当我尝试通过 https 从 mysysgit 克隆时出现错误。早些时候它在 http 上运行良好。无法识别失败的地方

$ git clone https://server.name/git/testing.git
Cloning into 'testing'...
* Couldn't find host server.name in the _netrc file; using defaults
* About to connect() to server.name port 443 (#0)
*   Trying server.name...
* Adding handle: conn: 0x274fd60
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x274fd60) send_pipe: 1, recv_pipe: 0
* Connected to server.name(server.name) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: C:\Users\user1\AppData\Local\Programs\Git/bin/curl-ca-bundle.crt
  CApath: none
* SSL certificate problem: self signed certificate
* Closing connection 0
fatal: unable to access 'https://server.name/git/testing.git/': SSL certificate problem: self signed certificate

回答by Pradeep S

If you are getting an error while doing a git clone, then above needs to be changed to:

如果您在执行 a 时遇到错误git clone,则需要将上述更改为:

git config --global http.sslVerify false

回答by VonC

You might have to disable the certificate verification in your case:

在您的情况下,您可能必须禁用证书验证:

cd /path/to/repo
git config http.sslVerify false

(as in "Git: ignore a self signed certificate")

(如“ Git:忽略自签名证书”)

The other option, similar to "Unable to clone Git repository due to self signed certificate" would be to import that certificate into git.

另一个选项,类似于“由于自签名证书而无法克隆 Git 存储库”是将该证书导入到 git 中。

That is: copied it at the end of the file /path/to/git/bin/curl-ca-bundle.crt.

即:将其复制到文件末尾/path/to/git/bin/curl-ca-bundle.crt

I would not advise git config --global http.sslVerify false, as that would disable certificate verification for alllocal repositories.

我不建议git config --global http.sslVerify false,因为这会禁用所有本地存储库的证书验证。

回答by madholic

Check your .gitconfig file.

检查您的 .gitconfig 文件。

If you've found the following line, Remove it!

如果您发现以下行,请将其删除!

[http]
sslCAinfo = /bin/curl-ca-bundle.crt

It worked for me.

它对我有用。