git guide]1に従いましたが、githubに接続しようとすると奇妙な問題が発生します。
$ ssh -v [email protected]
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/Documents and Settings/mugues/.ssh/config
debug1: Applying options for github.com
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: connect to address 207.97.227.239 port 22: Attempt to connect timed out without establishing a connection
ssh: connect to host github.com port 22: Bad file number
これは .ssh での私の設定ファイルです。
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile "C:\Documents and Settings\mugues\.ssh\id_rsa"
TCPKeepAlive yes
IdentitiesOnly yes
何かアイデアはありますか?
私自身がこの問題に直面した後、私は自分に合った解決策を見つけました。
**エラーメッセージ:***。
ssh -v [email protected]
OpenSSH_5.8p1, OpenSSL 1.0.0d 8 Feb 2011
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: connect to address 207.97.227.239 port 22: Connection timed out
ssh: connect to host github.com port 22: Connection timed out
ssh: connect to host github.com port 22: Bad file number
WindowsでMINGGWシェルを使用している場合にのみ、ファイル番号が悪いというメッセージが表示されます。LinuxユーザーはTimed outになるだけです。
**問題点:***。
SSHはおそらくポート22でブロックされています。と入力することで確認できます。
$nmap -sS github.com -p 22
Starting Nmap 5.35DC1 ( http://nmap.org ) at 2011-11-05 10:53 CET
Nmap scan report for github.com (207.97.227.239)
Host is up (0.10s latency).
PORT STATE SERVICE
22/tcp ***filtered*** ssh
Nmap done: 1 IP address (1 host up) scanned in 2.63 seconds
状態が Filtered になっているのがわかると思いますが、これは何かがブロックしているということです。 これを解決するには、ポート443へのSSHを実行します(ファイアウォールやISPがこれをブロックすることはありません)。 また、github.comではなく、"ssh.github.com"にSSHする必要があることも重要です。 そうしないと、sshサーバーではなくウェブサーバーにレポートされてしまいます。 以下に、この問題を解決するために必要なすべての手順を示します。
解決方法:
(まず、http://help.github.com/win-set-up-git/で説明されているように、鍵が生成されていることを確認してください)
ファイル ~/.ssh/config を作成する (ユーザディレクトリにあるssh設定ファイル。
Windows の場合は、おそらく %USERPROFILE%\.ssh\config
です。
その中に以下のコードを貼り付けます。
Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
ファイルを保存してください。
いつものようにsshを実行します。
$ssh -T github.com
$Enter passphrase for key '.......... (you can smile now :))
ユーザー名やポート番号を入力する必要がないことに注意してください。