github/bitbucketに登録する
鍵登録
| 1 2 3 | % ssh-keygen -t rsa -f id_rsa.bitbucket -C mail@domain.com % ssh-keygen -t rsa -f id_rsa.github -C mail@domain.com | 
鍵の権限変更
| 1 2 3 | % chmod 600 id_rsa.bitbucket % chmod 600 id_rsa.github | 
~/.ssh/configへの登録
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |  # vi ~/.ssh/config Host alters.bitbucket.org #独自ホストに変更   HostName bitbucket.org   IdentityFile ~/.ssh/id_rsa.bitbucket   User git   Port 22   TCPKeepAlive yes   IdentitiesOnly yes Host alters.github.com   User git   Port 22   HostName github.com   IdentityFile ~/.ssh/id_rsa.github   TCPKeepAlive yes   IdentitiesOnly yes #IdentityFileは前項で作成した鍵のパス | 
web上から鍵登録
| 1 2 3 | # less id_rsa.github.pub ssh-rsa xxxx== mail@domain.com | 
をコピーして
githubでは
setting > SSH keys > Add SSH Key
で鍵を追加する
bitbucketでは
プロフィール > 管理 > ssh キー > 鍵を追加
初回アクセス
初回はコマンドからログインしなければなりません。
※最初からwebで全て操作できない
| 1 2 |  # ssh -T git@bitbucket.org | 
Tips
githubは
https://github.com/(ユーザー名).keys
でSSH公開鍵が表示されます。
例)
https://github.com/nsm0.keys





