【问题标题】:git clone https/ssl error [duplicate]git clone https/ssl 错误 [重复]
【发布时间】:2013-10-03 10:39:03
【问题描述】:

我已经在我的 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

【问题讨论】:

标签: git ssl https


【解决方案1】:

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

git config --global http.sslVerify false

【讨论】:

  • 您可能永远不应该像这样在全局范围内这样做。在没有 --global 的情况下按每个 repo 执行此操作。
  • 同意 Travis --global 存在重大安全风险。
  • 查看其他问题/答案stackoverflow.com/questions/11621768/…,了解如何根据每个命令执行此操作:git -c http.sslVerify=false clone . . .
  • 适用于:fatal: unable to access 'https://github.com/somerepo.git/': Problem with the SSL CA cert (path? access rights?)`
【解决方案2】:

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

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

(如“Git: ignore a self signed certificate”)

另一个选项,类似于“Unable to clone Git repository due to self signed certificate”,是将证书导入 git。

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

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

【讨论】:

  • 我得到了 => 致命的:不在 git 目录中。什么意思?
  • @Aguid 表示你还没有在本地 git 存储库中执行该命令(其中包含 .git 子文件夹的文件夹)
  • @Aguid 是的,但不推荐。请参阅我编辑的答案。
【解决方案3】:

检查您的 .gitconfig 文件。

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

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

它对我有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-06
    • 1970-01-01
    • 2016-04-05
    • 2015-09-09
    • 1970-01-01
    • 2017-07-15
    相关资源
    最近更新 更多