Github kex_exchange_identification Connection closed by remote host

问题描述

1
2
3
4
5
6
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.

解决方法

本地生成.pub文件

1
2
ssh-keygen -t ed25519 -C "your_mail@xxx.com"
ssh-agent bash

会在C:\Users\admin\.ssh目录生成一个id_ed25519.pub文件,复制里面的内容。

Github 新建 SSH key

打开 Github,点击 Setting 如下图所示:

Setting

在 Setting 页面中找到 SSH and GPG keys 选项,新建 SSH key。

SSH and GPG keys

Title 内容任意,Key 文本框内填入 id_ed25519.pub 内的内容。

SSH keys

重新尝试上传。

如果仍然有上述错误提示可进行以下操作:

1
2
3
4
5
6
git init
git add .
git commit -m "init"
git branch -M main
git remote add origin git@github.com:xxx/xxx.git
git push -f -u origin main

Github kex_exchange_identification Connection closed by remote host
https://blog.lfd.world/2023/05/31/github-kex-exchange/
作者
培根请加蛋
发布于
2023年5月31日
许可协议