问题:

  • 本地项目push到github失败

    Push failed
    Kex_exchange_identification: Connection closed by remote hostConnection closed by 20.205.243.166 port 22
    Could not read from remote repository.
    Please make sure you have the correct access rightsand the repository exists.

  • 同样地,从github中clone、pull、fetch也报上述错误

解决方法

  • 一般情况下是以上错误都是因为挂着VPN导致端口冲突

  • 目前遇到两类情况,解决办法如下。

1 网络本身无vpn,使用ShadowsocksR等工具科学上网

  • 退出ShadowsocksR即可
  • 缺点:访问github会变慢,毕竟把vpn关掉了。如果开vpn本身就是为了更快速的访问github,那这样的操作就很费劲,每次和远程仓库交互都要关掉vpn,搞完再打开,推荐2.1。

2 网络本身挂载vpn,如openwrt上安装了ShadowsocksR

  • 解决办法有两种(推荐第一种)
2.1 修改项目目录中隐藏文件夹 .git 内的 config 文件
  • 将 Project/.git/config 文件中ssh格式的url,修改为github仓库中https格式的url。如:

    url = https://github.com/username/SpringBootWebTest.git

  • 因为开着vpn,代理端口走22;同时git的ssh一般也使用22端口,这样造成冲突;而git的https一般使用443端口,不会产生冲突。

  • 一般企业防火墙会打开80和443这两个http/https协议的端口,因此在架设了企业防火墙的时候使用https可以很好地绕开安全限制使用git;但是对于ssh来说,企业防火墙很可能没打开22端口。

  • 如果按以上操作修改之后报错Invocation failed Server returned invalid Response.,则到IDEA等软件的配置界面,选中 Use credential helper 即可,参考。路径如下:

    File -> Settings -> Version Control -> Git-> Use credential helper

2.2 修改openwrt的ShadowsocksR的访问控制配置
  • 在访问控制的不走代理名单中加入 github.com ,保存并应用,这样访问github的操作就与 1 中一样了,缺点也一样

其他

还有其他的不同情况下的解决方案,可以根据实际情况寻找对应的解决办法

Git报错Kex_exchange_identification相关推荐

  1. git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists)....

    Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists). 解决办法一:保 ...

  2. Git报错: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

    Git报错: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 在使用Git来克隆仓库报了错误,如下: fa ...

  3. git报错fatal: HTTP request failed

    关于git报错的原因,见下链接 此链接为转载: https://blog.csdn.net/zhang_danf/article/details/45538825 我遇到是curl 版本问题,更新cu ...

  4. Git报错解决:fatal: unable to access ‘https://github.com/...‘: OpenSSL SSL_read:..., errno 10054

    Git报错解决:fatal: unable to access 'https://github.com/-': OpenSSL SSL_read: Connection was reset, errn ...

  5. git报错the remote end hung up unexpectedlyMiB解决方法

    git报错the remote end hung up unexpectedlyMiB解决方法 原文地址:http://blog.tachmiao.com/?id=98 在公司可能因为网络波动的原因, ...

  6. 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).

    Git 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists). 开发新业务,拉取代码时,路由文件发生冲突,解决此文件 ...

  7. Git 报错:You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).Please, commit your changes

    Git 报错 在 IDEA 中使用 Git 报错: You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).Please, ...

  8. GIT 报错:Branch ‘master‘ set up to track remote branch ‘master‘ from ‘origin‘

    GIT 报错:Branch 'master' set up to track remote branch 'master' from 'origin' git上传仓库时报错 解决方法共两步 1.移除 ...

  9. git报错error: index uses extension, fatal: index file corrupt

    git报错 error: index uses extension, which we do not understand fatal: index file corrupt 用git 拉取代码时,遇 ...

  10. git 报错 destination path already exists and is not empty director

    git 报错 destination path already exists and is not empty director 既然报错 必然存在报错的机制 报错机制 桌面上创建任意文件夹 拉取任意 ...

最新文章

  1. 需求调研计划_拆书营销管理 实施营销调研和预测需求
  2. Mongodb实战使用指南
  3. Python 代码风格指南谷歌版
  4. 猎鹰spacex_我从SpaceX中学到的关于开源的一切
  5. JBuilder配置JBoss
  6. java实体类中有枚举类型_实体类的枚举属性--原来支持枚举类型这么简单,没有EF5.0也可以...
  7. linux服务占用的真实内存,为什么TOP看不出真实的内存占用情况?
  8. 删除virtual bridge
  9. LINUX虚拟机安装增强功能时报错: Kernel headers not found for target kernel. Please install them and execute
  10. Linux设备驱动入门
  11. 用Python做一个证件照制作器
  12. PyCharm - Split Vertically Split Horizontally (垂直拆分窗口 水平拆分窗口)
  13. 面试官问:“在项目中用过多线程吗?”你就把这个案例讲给他听!
  14. 基于Java Servlet 构建的在线音乐服务器
  15. 中国大学最卷的专业,让我读上了
  16. 为什么需要制定计划?
  17. 中级职称计算机excel 公式,中级职称计算机试Excel应用模拟题库.doc
  18. 计算机辅助物理化学实验 唐典勇课后答案,计算机辅助物理化学实验(第2版)...
  19. 最佳的75个安全工具
  20. mysql 储存过程/函数调试

热门文章

  1. python绘制网格线_在主网格线下方绘制次要网格线
  2. win计算机名长度限制,Win7,Server 2012文件名过长无法删除解决方案
  3. Hybrid App(混合模式移动应用)
  4. 最短路径问题---SPEA算法详解
  5. quartz2.2.3 spring整合遇到的错误,及quartz配置文件说明
  6. 巨头环伺下,青云QingCloud的云计算之路危机重重
  7. c语言srand函数用法,srand
  8. android-自定义锁屏界面
  9. PHP实现分页功能(一)上一页/下一页(含有分类功能的分页)
  10. 程序员做脚底鱼疗,因脚臭熏死一大批鱼,老板据说是这表情