LoginSignup
88
65

More than 5 years have passed since last update.

Githubにport:22 で push できなかった場合の対処法

Last updated at Posted at 2014-09-06

VagrantのCentOS環境下で、originで指定したリモートへアクセスしようとしたところ、以下のようなエラーがでました。

$ git push -u origin master
ssh: connect to host github.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly


そこで、公式のヘルプ
https://help.github.com/articles/using-ssh-over-the-https-port
にあるように Port:443 に接続してみます。

$ ssh -T -p 443 git@ssh.github.com

これだと接続できました。
次に、 Port:443 で接続するように設定ファイルを作ります。

$ vi ~/.ssh/config
Host github.com
    User git
    Hostname ssh.github.com
    Port 443
    IdentityFile ~/.ssh/id_rsa

identityFileはssh鍵のあるパスを指定します。そして、接続テストをします。

$ ssh -T git@github.com

ここで、接続できれば完了です。


もしかすると、こんなエラーが出るかもしれません。

Bad owner or permissions on /home/vagrant/.ssh/config

configファイルのアクセス権限に問題があるようなので、chmodコマンドを使って権限を書き換えます。

$ chmod 600 ~/.ssh/config

再度、接続テスト

$ ssh -T git@github.com

これで通りました。



参考文献
https://help.github.com/articles/using-ssh-over-the-https-port
http://mattn.kaoriya.net/software/20081029172540.htm
http://futuremix.org/2005/10/openssh-config-permission

88
65
1

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
88
65