egit报错:cannot open git-upload-pack
第一次通过eclipse导入github 项目,按照百度步骤进行操作,发现不能连接 github,cannot open git-upload-pack。
- 报错原因
通过 eclipse 日志排查报错
!MESSAGE https://github.com/making/spring-boot-jersey-blank.git: cannot open git-upload-pack !STACK 0 org.eclipse.jgit.api.errors.TransportException: https://github.com/making/spring-boot-jersey-blank.git: cannot open git-upload-pack at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:196) at org.eclipse.egit.core.op.ListRemoteOperation.run(ListRemoteOperation.java:99) at org.eclipse.egit.ui.internal.clone.SourceBranchPage$8.run(SourceBranchPage.java:324) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/making/spring-boot-jersey-blank.git: cannot open git-upload-pack at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:499) at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:308) at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:175) ... 3 more Caused by: javax.net.ssl.SSLException: Received fatal alert: protocol_version at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source) at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:167) at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:462) ... 5 more
重点在于 : javax.net.ssl.SSLException: Received fatal alert: protocol_version , ssl 协议版本存在问题。
在 github 的 Weak cryptographic standards removal notice 中有提到,取消TLSv1
/TLSv1.1 的连接方式,对于jdk1.7 的用户可以显示的进行配置,对于jdk1.6 的客户建议升级jdk版本,jdk1.8及以上版本支出 TLSV1.2,故不用配置。
- 解决方法
我本地是1.7 需要进行相关的配置操作。
操作: 在 eclipse.ini 文件的最后加上 -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2(另起一行)
- 报错原因