Ubuntu中发生git Connection refused


今天在提交代码的时候:

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 则需要检查配置是否正确

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM