0
0

More than 1 year has passed since last update.

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

Posted at

エラー内容

徳丸本でハンズオンした後、git pushとかgit fetchができなくなっていました。
www.amazon.co.jp/dp/4797393165

zsh
$ ssh -T github.com
ssh: connect to host github.com port 22: Operation timed out

原因

ssh鍵を再発行して、githubに公開鍵を登録し直しましたが、相変わらずでした。

ググったところ、こちらの公式ページにたどり着きました。
https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port
試しに443ポートで接続すると、つながりました。どうやら、知らないうちにファイアウォールを設定していたみたいです。

zsh
$ ssh -T -p 443 git@ssh.github.com
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

解決方法

ssh設定ファイルに443ポートを設定します。

~/.ssh/config
Host github.com
    User git
    Hostname ssh.github.com
    Port 443
    IdentityFile ~/.ssh/id_rsa # 秘密鍵ファイル

以上です

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0