LoginSignup
5
1

More than 3 years have passed since last update.

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

Last updated at Posted at 2019-11-24

SSH接続エラー?

普段からGitHubにアクセスしているMacでコードをアップしようとすると、22番ポートでSSH接続できないとのエラーがでたので対処していく。

$ git push -u origin HEAD
ssh: connect to host github.com port 22: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

結論

443番ポートでアクセスする設定で接続することで、接続に成功した。22番ポートで接続できなくなった理由は不明のまま。

$ vi ~/.ssh/config
Host github.com
    User git
    Hostname ssh.github.com
    Port 443
    IdentityFile ~/.ssh/id_rsa
$ git push -u origin HEAD
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 1.45 KiB | 1.45 MiB/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To github.com:toppy-luna/TodoList-Vuejs.git
 * [new branch]      HEAD -> issue#1_regist_code
Branch issue#1_regist_code set up to track remote branch issue#1_regist_code from origin.

参考

Githubにport:22 で push できなかった場合の対処法
https://qiita.com/SOJO/items/74b16221580a17296226

5
1
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
5
1