git之kex_exchange_identification: Connection closed by remote host
背景
在window10中,使用git提交代码到Github上时拒绝连接,之前使用的时候是正常的。
一、遇到的问题
在拉取、推送代码时遇到以下报错:
⚡ke❯❯ git pull
kex_exchange_identification: Connection closed by remote host
Connection closed by 20.205.243.166 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
原因:
github的22端口抽风了,也有可能是代理端口屏蔽了22。
二、解决方法
方法1:
在~/.ssh/config 配置中修改为以下的格式
Host im.github.com
HostName ssh.github.com
IdentityFile ~/.ssh/id_rsa_github_im
User im
Port 443
ProxyCommand "D:\Program Files\Git\mingw64\bin\connect.exe" -S 127.0.0.1:7890 %h %p
注意:关键点是HostName改为ssh.github.com ,
Port 改为443,
ProxyCommand 改为你本地git对应的路径
附件
本文来自博客园,作者:所遇所思,转载请注明原文链接:https://www.cnblogs.com/mynxg/p/17989277
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步