Bitbucket登録後にSSHの公開鍵を設定する時のメモ
$ cd ~/.ssh
$ mkdir bitbucket
$ cd bitbucket
$ ssh-keygen -t rsa -C "bitbucketにユーザ登録しているメールアドレス"
ここまで打つと
Enter file in which to save the key (/Users/your_user_directory/.ssh/bitbucket/id_rsa):
ってでるので以下コピー
id_rsa.bitbucket.org
続けて2回Enter
すると
- id_rsa.bitbucket.org
- id_rsa.bitbucket.org.pub
の2つができる。
$ chmod 600 id_rsa.bitbucket.org
でアクセス権限を変更して完了。
$ vim ~/.ssh/config
viで開く。開いた状態はコマンドモードなので、iとか押して入力モードに。コマンドモードにはESCで。
以下をコピペ
Host bitbucket.org HostName bitbucket.org IdentityFile ~/.ssh/bitbucket/id_rsa.bitbucket.org User git Port 22 TCPKeepAlive yes IdentitiesOnly yes
入力終わったらコマンドモードにして:wqで保存して終了
アカウント管理のSSH keyの部分にさっき生成されたid_rsa.bitbucket.org.pubの中身をコピペで完了。
SHA256:f4jdmZgW0s7wZJ0LCc21WftH7P2KUl6awRnQH7SZmvE [email protected]
The key's randomart image is:
+---[RSA 2048]----+
| ...o |
| o...+.* |
| . o.+.=.o|
| o o..+.|
| S B.=oE =|
| % B=+. o|
| . @o= .|
| ...+. . |
| .. . |
+----[SHA256]-----+