在进行软件构造实验时,从eclipse中pull项目到github上我遇到了如图的问题
查看报错日志
org.eclipse.jgit.api.errors.TransportException: https://github.com/muzhiyi1996/test1.git: cannot open git-upload-pack
at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:222)
at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:161)
at org.eclipse.egit.core.op.ListRemoteOperation.run(ListRemoteOperation.java:116)
at org.eclipse.egit.ui.internal.components.RefSpecPage$2.run(RefSpecPage.java:255)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/muzhiyi1996/test1.git: cannot open git-upload-pack
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:624)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:391)
at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:200)
... 4 more
Caused by: java.net.ConnectException: Connection time out: github.com
at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:235)
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:539)
... 6 more
经过查阅相关资料后解决方案如下:
Preferences-->Team-->Git,修改成300
2. Preferences-->Team-->Git-->Configuration-->User Settings.
然后点击Add Entry,输入http.sslVerify=false
3. 修改eclipse.ini文件
在文件中添加 -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2。
这个问题是说旧版eclipse默认JDK版本是1.7,默认支持TLSv1.1,Git现在不支持该协议。而JDK版本是1.8的话,默认支持TLSv1.2,不会有该问题
4. Preferences-->General-->Network Connection,修改Active Provider为Direct
5. 如果以上办法都无效的话,查阅资料发现ping网址,因为能够登录github.com的,所以一直没想到该问题,之后cmd-->ping github.com
问题原因找到了,解決:
找到github.com 的一个ip地址,
打开C:\Windows\System32\drivers\etc\hosts文件,在末尾添加 ip地址+github.com
再次ping github
问题得到解决!eclipse成功pull项目到个人仓库。