Eclipse导入github报错

Posted zz-1q

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Eclipse导入github报错相关的知识,希望对你有一定的参考价值。

  1. 报错:cannot open git-upload-pack

     第一次通过eclipse导入github 项目,按照百度步骤进行操作,发现不能连接 github,cannot open git-upload-pack。

    技术分享图片

    技术分享图片

     

  2. 报错原因
    通过 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,故不用配置。

  3. 解决方法
    我本地是1.7 需要进行相关的配置操作。
    操作: 在 eclipse.ini 文件的最后加上 -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2(另起一行)
    技术分享图片

     

 

 








以上是关于Eclipse导入github报错的主要内容,如果未能解决你的问题,请参考以下文章

Spring4源码编译完成后导入eclipse报错求助

Eclipse导入已有的项目后项目报错的解决办法

eclipse导入web项目报错

Eclipse导入Web项目后代码不报错但项目报错(左上角有红叉)解决方案

eclipse导入项目出现红色感叹号

Eclipse提交git代码 报错authentication not supported