今天在提交代码的时候:

ssh: connect to host github.com port 22: Connection refused
fatal: 无法读取远程仓库。

请确认您有正确的访问权限并且仓库存在。

英文:
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.

 刚开始重启IDEA,后来重启虚拟机,再后来重启电脑。百度上还有说是wifi问题,插了网线也无法解决。

后来找到了如下方法,解决问题,顺利提交代码:

ai@aiai:~$ vim .ssh/config

内容为:

Host github.com
User #################@qq.com                                       (这个地方是写github登陆时的用户名)
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/Ai                                               (私钥地址)
Port 443

之后可以使用如下命令测试

ssh -T git@github.com
返回:Hi user1! You've successfully authenticated, but GitHub does not provide shell access. 则正常
若:ssh: connect to host github.com port 22: Connection refused 则需要检查配置是否正确

 

相关文章:

  • 2021-12-28
  • 2021-08-07
  • 2022-02-17
  • 2022-12-23
  • 2022-01-10
  • 2021-06-15
  • 2022-12-23
  • 2021-12-21
猜你喜欢
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
相关资源
相似解决方案