Transport Error: Cannot get remote repository refs.https://github.com/xxx/test1.git: cannot open git

Posted mt-1996

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Transport Error: Cannot get remote repository refs.https://github.com/xxx/test1.git: cannot open git相关的知识,希望对你有一定的参考价值。

问题出现:

  在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

 

经过百度后解决方案尝试如下:

1.日志显示连接超时,所以直接更改超时时间

  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,不会有该问题

  我的JDK版本是1.8,没有该问题,但还是将该方法放在此处,希望对他人有所帮助

4..Preferences-->General-->Network Connection,修改Active Provider为Direct

  该方法尝试后依旧无效

技术图片

 

5.上述办法都无效后,在百度时突然想起来ping网址,因为我是能登录github.com的,所以一直没想到该问题,之后cmd-->ping github.com

技术图片

 

 问题原因找到了,解决:

  https://www.ipaddress.com/ip-lookup 在该网址输入github.com,查出一个ip地址,

  打开C:WindowsSystem32driversetchosts文件,在末尾添加 ip地址+github.com

技术图片

 

 技术图片

 

 再次ping github

技术图片

 

 问题解决!eclipse问题也解决

以上是关于Transport Error: Cannot get remote repository refs.https://github.com/xxx/test1.git: cannot open git的主要内容,如果未能解决你的问题,请参考以下文章

org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known serve

Error when connecting to the GNS3 server: Cannot connect to http://127.0.0.1:3080. Please check if G

解决Error: Cannot find module 'node-sass'问题

ERROR: transport error 202: bind failed: Address already in use ERROR: JDWP Transport dt_socket fail

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory failed error='Cannot allocate memory&#