ssh: connect to host github.com port 22: Connection timed out

主要是更改一下ssh的端口,由22改为443

  1. 进入.ssh下
  2. 新建config文件
  3. 添加以下内容
  4. Host github.com
    User git
    Hostname ssh.github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa
    Port 443

    Host gitlab.com
    Hostname altssh.gitlab.com
    User git
    Port 443
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa

     

  5. 进入项目根目录,打开cmd,输入ssh -T git@github.com(如果遇到啥选项或者问题什么的,选yes就行了),最后出现Hi xxx! You've ......就可以了。
    ssh -T git@github.com
    Hi xxxxx! You've successfully authenticated, but GitHub does not
    provide shell access.
  6. 再次尝试push/pull项目即可
posted @ 2024-01-24 00:04  一叶、知秋  阅读(60)  评论(0编辑  收藏  举报