参考文章:
gitee git推拉报错 kex_exchange_identification问题记录 fatal: Could not read from remote repository
其他git库可以正常访问,唯独gitee不可以推拉。
自查系统:
PS D:\src\gitee\jasypt-spring-boot> git fetch
/c/Users/Thinkpad/.ssh/config: line 7: Bad configuration option: pubkeyacceptedalgorithms
/c/Users/Thinkpad/.ssh/config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
PS D:\src\gitee\jasypt-spring-boot> ssh -V
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
PS D:\src\gitee\jasypt-spring-boot> git --version
git version 2.24.1.windows.2
问题根源:gitee升级了
。
第二种临时方案:
之前各种尝试就包括了第二种临时方案,删除旧的giteeSSH公钥
,新添加公钥使用ed25519
,但是:也不没有解决问题。
第一种方案:
PS D:\src\gitee\jasypt-spring-boot> git fetch
/c/Users/Thinkpad/.ssh/config: line 7: Bad configuration option: pubkeyacceptedalgorithms
/c/Users/Thinkpad/.ssh/config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.
看看别人怎么说:
原文:Windows 11 升级OpenSSH 【解决由版本过低导致的Bad configuration option: pubkeyacceptedalgorithms错误】
所以需要升级OpenSSH,但是不能超过8.8。
按照上面的方法升级一下,想用人家的百度网盘下载,结果:
一个插曲,还好升级比较快,两三分钟后就再次打开并下载。
其中有略微不同之处:
安装ssd服务(PS中)
PS C:\Users\Thinkpad> powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
-File 形式参数的实际参数“install-sshd.ps1”不存在。请提供现有“.ps1”文件的路径,作为 -File 形式参数的一个实际参数。
PS C:\Program Files> cd .\OpenSSH-Win64\
PS C:\Program Files\OpenSSH-Win64> powershell.exe -ExecutionPolicy Bypass -File .\install-sshd.ps1
配置自动启动(cmd命令窗口,start=auto中间不能有空格)
C:\Users\Thinkpad>sc config sshd start=auto
[SC] ChangeServiceConfig 成功
后面我又升级了git for windows
,使用环境path中的ssh,可是。。。
PS D:\src\gitee\jasypt-spring-boot> ssh -T git@gitee.com
kex_exchange_identification: read: Connection reset
Connection reset by 212.64.62.183 port 22
写到这吧,问题没解决。。。
又commit一次代码,不能访问gitee实在憋屈,于是咨询客服,很忙,给了一个提示,删除hosts中的gitee.com
ssh-keygen -R gitee.com
用来更新.ssh/known_hosts
从hosts文件中注释删除gitee.com
#212.64.62.183 gitee.com
PS D:\src\gitee\jasypt-spring-boot> git fetch
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88.
Please contact your system administrator.
Add correct host key in C:\\Users\\Thinkpad/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in C:\\Users\\Thinkpad/.ssh/known_hosts:11
Host key for gitee.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
# 根据提示需要更新known_hosts
PS D:\src\gitee\jasypt-spring-boot> ssh-keygen -R gitee.com
# Host gitee.com found: line 11
C:\Users\Thinkpad/.ssh/known_hosts updated.
Original contents retained as C:\Users\Thinkpad/.ssh/known_hosts.old
PS D:\src\gitee\jasypt-spring-boot> git fetch
The authenticity of host 'gitee.com (212.64.63.215)' can not be established.
ED25519 key fingerprint is SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Warning: Permanently added 'gitee.com' (ED25519) to the list of known hosts.
PS D:\src\gitee\jasypt-spring-boot> tail C:\Users\Thinkpad/.ssh/known_hosts -n 1
gitee.com ssh-ed25519 AAAAC3NzaC1.........kJ4YdEi5tngynE8aZe2uEoVVsB/OvYN
# 之前没有注释hosts中的gitee.com的时候,在known_hosts中是不会有gitee.com的配置的
PS D:\src\gitee\jasypt-spring-boot> git pull
Already up to date.
PS D:\src\gitee\jasypt-spring-boot> ssh -T git@gitee.com
Hi menglingzhi! You've successfully authenticated, but GITEE.COM does not provide shell access.
是否需要升级OpenSSH到8.6,现在也不确定。