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

本文讲述了在Windows10中使用Git时遇到的连接GitHub问题,由于GitHub22端口问题或代理限制,给出了解决方案,包括在.ssh/config文件中修改HostName、Port和使用ProxyCommand。
7524

被折叠的 条评论
为什么被折叠?



