Github ssh的连接问题

1,143 阅读1分钟

问题

kex_exchange_identification: Connection closed by remote host Connection closed by 127.0.0.1 port 7890 fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. or ssh: connect to host github.com port 22: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

解决办法

  • 新增配置文件
vim ~/.ssh/config
  • 添加以下内容
Host github.com
    HostName ssh.github.com
    Port 443
    User git
  • 验证配置
ssh -T github.com

最终结果

image.png