woshidan's loose leaf

ぼんやり勉強しています

BitBucketにgitでアクセス、あるいは新しいサイトでssh認証するときの鍵の登録と確認の手順

https://qiita.com/yyosuke/items/986dabc9906674e2ea97 を参考にSSHの公開鍵をBitBucketに登録。

~/.ssh/configbitbucket.org に当該の秘密鍵を使ってアクセスするように設定する。

# サイトごとに鍵を分けた方が良い。。。
Host bitbucket.org
  HostName bitbucket.org
  IdentityFile ~/.ssh/bitbucket/id_rsa
  User git
  Port 22
  TCPKeepAlive yes
  IdentitiesOnly yes
$ ssh -T bitbucket.org
The authenticity of host 'bitbucket.org (104.192.143.2)' can't be established.
RSA key fingerprint is SHA256:UvlgyNccfRyg8jrD8dzU2lwwd4dDWYbx4NfILUjQkKL(この値はダミー).
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bitbucket.org,104.192.143.2' (RSA) to the list of known hosts.
logged in as UserName.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

あとはほぼGitHubと同じで、remote リポジトリを指定するときのホストが bitbucket.org になっているだけ。