LoginSignup
35
28

More than 5 years have passed since last update.

BitbucketでPort:22でエラーが発生した場合の対処法

Posted at

VagrantのCentOS環境下で、Bitbucketにpushできなかったのでメモ


設定ファイルを以下のようにして設定

$ vi ~/.ssh/config
Host bitbucket.org
  User git
  Port 22
  Hostname bitbucket.org
  IdentityFile ~/.ssh/id_rsa

接続テスト

$ ssh -T git@bitbucket.org
ssh: connect to host bitbucket.org port 22: Connection timed out

とエラーが出る。どうやら、Port:22がいけないようなので、設定ファイルを変更します。


$vi ~/.ssh/config
Host bitbucket.org
  User git
  Port 443
  Hostname altssh.bitbucket.org
  IdentityFile ~/.ssh/id_rsa

ssh.bitbucket.org ではなく、 altssh.bitbucket.org であることに注意(私はかなり長い間気づきませんでした)
接続テスト

$ ssh -T git@bitbucket.org

これで通りました。


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

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

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

$ chmod 600 ~/.ssh/config


参考文献
http://garbers.co.za/2014/03/03/connecting-to-bitbucket-on-https-port/
http://morizyun.github.io/blog/ssh-key-bitbucket-github/
http://futuremix.org/2005/10/openssh-config-permission

35
28
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
35
28