前提
- macOS Sierra
作業
SSH Keyを生成
$ ssh-keygen -t rsa -b 4096 -C "hoge@example.com"
~/.sshの中にid_rsaとid_rsa.pubが生成されます。
id_rsa → 秘密鍵
id_rsa.pub → 公開鍵
Githubに公開鍵を登録
下記のURLにアクセス
https://github.com/settings/keys
Keyのところに公開鍵を丸々貼り付けて、Add SSH Keyをクリックします。
pbcopyを使うとクリップボードにコピーできて楽です。
$ pbcopy < ~/.ssh/id_rsa.pub
確認
$ ssh -T git@github.com
Hi m1ul24! You've successfully authenticated, but GitHub does not provide shell access.
successfullyみたいなメッセージがでればOKです
参考URL
https://qiita.com/suthio/items/2760e4cff0e185fe2db9
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
