謎のgit cloneエラー ssh: connect to host github.com port xxxx: Connection timed out
先ほどgit clone github〜みたいなことをやったらあまり見慣れないエラーが出た
$ git clone git@github.com:xxxxxxx/xxxxxxxxx.git Initialized empty Git repository in /path/to/.git/ ssh: connect to host github.com port 7654: Connection timed out fatal: The remote end hung up unexpectedly
まあ、エラーメッセージをみるかぎり、ポートがおかしい。
git cloneはsshをつかっているので、そのポートがおかしいのだろう。
ただ、それってなんでやねん、という所である、普通22だろ、7654なんて指定してないぞ。
こういうとき、http schemaでつなぐのも手だが、Private Repoなのでめんどうそう。あとはssh:// Schemeをつかうことで、ポート指定するGitアクセスもできるのだが、それもメンドイ。
sshなのであれば、.ssh/configにかいても回避できるはずであり。ややこしい事したくなかったので素直に追記した。
# ~/.ssh/config Host github.com User git Port 22 Hostname github.com
これで万事解決である。
ちなみに接続エラーを確認する方法は
$ ssh -v git@github.com
最後の方に
Hi hogehoge! You've successfully authenticated, but GitHub does not provide shell access.
こんなのがでればsshのレイヤーは問題無い。