W
e
l
c
o
m
e
: )

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对应的路径

附件

参考:
linux设置http/https proxy及忽略proxy的方法

posted @ 2023-12-14 17:26  所遇所思  阅读(371)  评论(0编辑  收藏  举报  来源