今天在提交代码的时候:
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 则需要检查配置是否正确
来源:https://www.cnblogs.com/easilyai/p/12371659.html