eclipse連接github 報錯 cannot open git-upload-pack

eclipse報錯信息爲cannot open git-upload-pack,如下圖:不管是下面的哪一種情況其實都是一個問題,下面詳細分析。


根據以上異常信息去百度,基本上的回答都是告你在eclipse-window-preferences-team-git-configuration中

add entry,設置key爲http.sslVerify,值爲false,然後apply,就解決了,然而並不是這麼簡單。。。。當然這一步還是要做的,爲了確保後面的操作能成功吧。

後來看到這篇博文http://blog.csdn.net/uikoo9/article/details/79383201,他提醒到會是ssl協議的版本不對。

查看eclipse的錯誤日誌,找到如下異常信息:

MESSAGE https://github.com/apache/hadoop.git: cannot open git-upload-pack
!STACK 0
org.eclipse.jgit.api.errors.TransportException: https://github.com/apache/hadoop.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:122)
或者
org.eclipse.jgit.errors.TransportException: https://github.com/XXXX/XXXX.git: cannot open git-receive-pack
.......
... 3 more
最重要的異常信息其實是:
Caused by: javax.net.ssl.SSLException: Received fatal alert: protocol_version
就是ssl協議的版本不對,上面提到的博客還貼出了github的通知:

2018年2月8日後禁止通過TLSv1.1協議連接https://github.com 和 https://api.github.com.

原文地址爲https://githubengineering.com/crypto-removal-notice/

原文截取爲:

February 8, 2018 we’ll start disabling the following:

  • TLSv1/TLSv1.1: This applies to all HTTPS connections, including web, API, and git connections to https://github.com and https://api.github.com.
  • diffie-hellman-group1-sha1: This applies to all SSH connections to github.com
  • diffie-hellman-group14-sha1: This applies to all SSH connections to github.com
總結原因就是:

我的eclipse是4.4.0版的並不是最新版的,因此我的ecplise的默認JDK爲JDK1.7,當然最新版的eclipse默認是1.8的不會有這個問題,因爲JDK1.8默認支持TLSv1.2,JDK1.7默認是TLSv1.1,所以需要將eclipse中的TLSv1改爲TLSv1.2。怎麼改呢?

其實很簡單,網上答案千奇百怪但是如果eclipse的默認JDK是1.7的就簡單,如果是1.7以下的請另外百度。。。。

打開eclipse安裝目錄下的eclipse.ini添加一句:-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2  就可以了。如圖:



原文地址:https://blog.csdn.net/royal__moon/article/details/79427431

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章