使用 TortoiseGit 创建 git clone 时出现 SSL 证书问题

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

SSL certificate issue while creating git clone with TortoiseGit

gitsslssl-certificatetortoisegit

提问by abhishek kumar gupta

I want to clone the git repository with the help of TortoiseGit, but I am getting error :

我想在 TortoiseGit 的帮助下克隆 git 存储库,但出现错误:

error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://git.assembla.com/pplconnect-PL.webserver.git/info/refs?service=git-upload-packfatal: HTTP request failed

错误:SSL 证书问题,请验证 CA 证书是否正常。详细信息:错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:访问https://git.assembla.com/pplconnect-PL.webserver.git/info/refs?service=git-upload-pack 时证书验证失败 :HTTP 请求失败

git did not exit cleanly (exit code 128).

git 没有完全退出(退出代码 128)。

Any help or guidance will be well appreciated.

任何帮助或指导将不胜感激。

Screenshot

截屏

回答by user294580

You can choose to ignore the server certificate (at your own risk!).

您可以选择忽略服务器证书(风险自负!)。

Configure your TortoiseGit in the following way. First of all open the TortoiseGit settings.

按以下方式配置 TortoiseGit。首先打开 TortoiseGit 设置。

Then:

然后:

  1. Select the Git configuration
  2. Open the global git configuration pressing "Edit systemwide gitconfig"
  3. In the [http]section write:
  1. 选择 Git 配置
  2. 按“ Edit systemwide gitconfig”打开全局 git 配置
  3. 在该[http]部分写:

[http]
sslVerify = false

[http]
sslVerify = false

回答by JVS

Configure git to use the right root certificate. Get the root CA certificate of the server and add it to the git config. Run this in command prompt (don't forget to cd into your git repo)

配置 git 以使用正确的根证书。获取服务器的根CA证书并将其添加到git config中。在命令提示符下运行它(不要忘记 cd 进入你的 git repo)

git config http.sslCAinfo ~/certs/cacert.pem

You can choose to ignore the server certificate (at your own risk!).

您可以选择忽略服务器证书(风险自负!)。

git config http.sslVerify false

Security Warning:This is susceptible to Man in the Middle attacks. Be sure that this security concern is not an issue for you before you disable SSL certification verification.

安全警告:这很容易受到中间人攻击。在禁用 SSL 证书验证之前,请确保此安全问题对您来说不是问题。

回答by FRob

All the top answers are really dangerous! Do not disable SSL verification globally!

所有顶级答案都非常危险!不要全局禁用 SSL 验证!

Instead, use the excellent answer in another threadand very selectively allow a self-signed certificate for a specific site.

相反,使用另一个线程中的优秀答案并非常有选择地允许特定站点的自签名证书。

Edit the global .gitconfigfile to include

编辑全局.gitconfig文件以包含

[http "https://example.com"]
    sslCAInfo = C:\Users\<username>\Documents\ssl\example.com.crt

The CRT file itself can be obtained in multiple ways. You can just save it using Firefox, store it somewhere safe and point your config to it.

CRT 文件本身可以通过多种方式获得。您可以使用 Firefox 保存它,将其存储在安全的地方并将您的配置指向它。

回答by MrTux

Please check that your Git for Windows installation is correct.

请检查您的 Git for Windows 安装是否正确。

As you can see in the screenshot git.exe cannot find the template directory - so I suppose git.exe also cannot find the shipped CA certificates.

正如您在屏幕截图中看到的 git.exe 找不到模板目录 - 所以我想 git.exe 也找不到附带的 CA 证书。

If that doesn't help, see a description herefor including a certificate into the Git trust store.

如果这没有帮助,请参阅此处的说明以将证书包含到 Git 信任存储中。

回答by Frederik

Even though disabling ssl verifyication is considered dangerous for many reasons, sometimes this is feasible. Others have pointed out to use at least a "local" disabling, but not how to do this. For the record, here is how you can define in the global .gitconfigfile (in Windows located under c:\Users\username) for a single repository to use openssl and disable the check. Just add the following (adjusted) lines:

尽管出于多种原因禁用 ssl 验证被认为是危险的,但有时这是可行的。其他人指出至少使用“本地”禁用,但没有指出如何执行此操作。作为记录,以下是您如何在全局.gitconfig文件(在 Windows 中位于 下c:\Users\username)中定义单个存储库以使用 openssl 并禁用检查的方法。只需添加以下(调整后的)行:

[http "https://your.repo.com"]
 sslBackend = openssl
 sslVerify = false

For me this worked perfect. As noted and linked in the answer from FRob, here is a more nuanced optionthat uses the pem certificate that you can often download yourself, e.g. when "clicking" on the lock symbol in your browser before the url and searching for "additional information" (firefox, others should be similar).

对我来说,这很完美。正如 FRob 的回答中所指出和链接的那样,这里有一个更细微的选项,它使用您经常可以自己下载的 pem 证书,例如,当“单击”浏览器中 url 之前的锁定符号并搜索“附加信息”时(firefox,其他应该类似)。

回答by ethemsulan

Open Git CMD and run below command.

打开 Git CMD 并运行以下命令。

git config --global http.sslVerify false