简体   繁体   English

带有自签名证书,https的egit

[英]egit with self signed certificate, https

I would like to use a git repo that is accessigble through https, Https server has self signed certificate. 我想使用通过https可访问的git repo,Https服务器具有自签名证书。 I always get an error while trying to clone the repo with eclipse+egit: 尝试使用eclipse + egit克隆存储库时,总是会出现错误:

https://host/path : cannot open git-upload-pack sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target https:// host / path :无法打开git-upload-pack sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径

Is it possible to bypass this problem? 是否可以绕过此问题? I used export GIT_SSL_NO_VERIFY=1 command to skip ssl verification with the console client. 我使用了export GIT_SSL_NO_VERIFY=1命令来跳过控制台客户端的SSL验证。 This trick doesn't work with eclipse. 这个技巧不适用于日食。

Thanks, 谢谢,

Hubi 湖北

You can also just set eGit to ignore server verification. 您也可以将eGit设置为忽略服务器验证。 In Eclipse go to Window -> Preferences. 在Eclipse中,转到窗口->首选项。

From there go to Team -> Git -> Configuration 从那里转到团队-> Git->配置

Click "New Entry" 点击“新条目”

Key: http.sslVerify Value: false 密钥:http.sslVerify值:false

Click "OK" 点击“确定”

Click "OK" 点击“确定”

For a more detailed approach to this check out my blog post here: http://www.pur-logic.com/2012/04/21/egit-self-signed-certificate/ 有关更详细的方法,请在此处查看我的博客文章: http : //www.pur-logic.com/2012/04/21/egit-self-signed-certificate/

您必须将该证书导入密钥库(JDK目录中的默认密钥库cacerts或使用参数-Djavax.net.ssl.trustStore指定一个证书)。

The FAQ of CAcert provides the commandline for keytool: CAcert常见问题解答提供了keytool的命令行:

keytool -keystore $/PATH/TO/CACERTS/KEYSTORE -storepass changeit -import -trustcacerts -v -alias cacertclass1 -file root.crt
  • Possibly, you have to omit -trustcacerts to import a normal certificate. 可能必须省略-trustcacerts才能导入普通证书。
  • -alias might also be unnecessary -alias也可能是不必要的

I had some trouble with this too, but with a different story. 我对此也遇到了麻烦,但故事却有所不同。 The hostname for the Git repo didn't match the cert's hostname. Git存储库的主机名与证书的主机名不匹配。 Solution was to change the cert to match the hostname. 解决方案是更改证书以匹配主机名。

We should use http.sslCAInfo option for this use-case. 对于此用例,我们应该使用http.sslCAInfo选项。
However, eclipse JGit development status for this option has been stuck for a very long time. 但是,此选项的Eclipse JGit开发状态已经停留了很长时间。

FYI 费耶

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM