$ git push ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from

之前都好好的,今天git push突然出现这个问题

解决方法一:改用HTTP协议(我没试过,应该是可以的)

  • 就是把远程库地址改成HTTP协议的,好像是这个命令,自己搜一下
    git remote set-url origin https://username@github.com/username/repository.git

解决方法二:更改SSH端口(亲测可用)

  • 先试试这个命令 ssh -T -p 443 git@ssh.github.com
  • 此时出现如下提示信息
    The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
    ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
    This host key is known by the following other names/addresses:
        ~/.ssh/known_hosts:1: github.com
    Are you sure you want to continue connecting (yes/no/[fingerprint])? 
    
  • 输入yes,然后如果出现下面这个提示Hi 你的github用户名,则443端口连接成功
    Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts.
    Hi youname! You've successfully authenticated, but GitHub does not provide shell access.
    
  • C:\Users\your-username\.ssh\目录下创建config文件,输入
Host github.com
  HostName ssh.github.com
  Port 443
  • git push 或者git pull 应该就成功了
  • 13
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宗浩多捞

您的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值