LoginSignup
18

More than 5 years have passed since last update.

Vagrant環境で作ってるものをBitbucketにgit pushするまで

Last updated at Posted at 2014-04-06
 git remote add origin git@bitbucket.org:[your-account]/[your-project].git

ここまではうまくいくが、

git push -u origin --all

ここで以下のような警告(?)が出る。

The authenticity of host 'bitbucket.org (123.456.78.901)' can't be established.
RSA key fingerprint is ***********************************
Are you sure you want to continue connecting (yes/no)?

で、これにyesと答えても以下のような感じで結局失敗する。

Warning: Permanently added 'bitbucket.org,123.456.78.901' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

たぶんvagrant用のsshキーを作ってないからかもしれないと思い、確認。

ls -a ~/.ssh/
すると
authorized_keys  known_hosts

id_rsaid_rsa.pub みたいなセットが鍵になるみたいなのだが案の定それが無かった。なので作る。

このコマンド
ssh-keygen

passphrase とか聞かれるけどここは空欄のままでも問題ないらしい。[enter]を何度か連打すれば出来る。
その後もう一度

ls -a ~/.ssh/
すると
authorized_keys  id_rsa  id_rsa.pub  known_hosts

あとはこの .pub のほう(公開用)をBitbucketのsshキーに追加(右上の「アカウントの管理」ー>「sshキー」ー>「鍵を追加」。Labelは適当な名前で、Keyの中にファイルの中身をごっそり貼付ける感じ)。

そして再びpushしてみた。

どうやら上手くいったみたい。

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
18