44

我已经在我的 git 服务器中安装了 ssl 证书和密钥。但是当我尝试从 mysysgit 通过 https 克隆时出现错误。早些时候,它在 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
4

3 回答 3

79

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

git config --global http.sslVerify false
于 2013-12-20T10:36:25.390 回答
22

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")

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

That is: copied it at the end of the file /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 all local repositories.

于 2013-10-01T11:15:17.233 回答
4

检查您的 .gitconfig 文件。

如果您找到以下行,请将其删除!

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

它对我有用。

于 2014-10-27T09:05:14.457 回答