MacOs ssh_exchange_identification: Connection closed by remote host under Git bash [closed]

a background

       The code is on github, and the code is operated on the Mac terminal through the git command. After using the new os system, when I came to deal with it today, it git pull 分支名couldn’t be pulled down for a long time, and finally an error was prompted: ssh_exchange_identification: Connection closed by remote host under Git bash [closed]; When it was executed in the terminal ssh -vT [email protected], an error was prompted:

debug1: load_hostkeys: fopen /Users/wuhaiqiao/.ssh/known_hosts2: No such file
、、、、、、、、、、
、、、、、、、、、
debug1: expecting SSH2_MSG_NEWKEYS
、、、、、、、、
debug1: send_pubkey_test: no mutual signature algorithm
、、、、、、、、、、

Two solutions

.ssh/configI have been looking for it online for a long time, and one method that works for me is to add Host github.comconfigurations        under the terminal , as follows:

Host github.com
   Hostname ssh.github.com
   PreferredAuthentications publickey
   IdentityFile ~/.ssh/id_rsa   // 基于git生成的秘钥路径
   Port 

Guess you like

Origin blog.csdn.net/whq19890827/article/details/129151693