LoginSignup
7
9

More than 5 years have passed since last update.

githubにssh公開鍵を登録

Posted at

環境

  • mac OS X 10.8.5

フロー

  • sshキーペア作成
  • githubに公開鍵登録

sshキーペア作成

macにはssh-keygenというコマンドが最初から入っているので、
このコマンドを使用してキーペア(rsa)を作成します。

$ ssh-keygen -t rsa -C "コメント"
Enter file in which to save the key (/Users/hoge/.ssh/id_rsa):   ←enter押下
Enter passphrase (empty for no passphrase):   ←enter押下
Enter same passphrase again:    ←enter押下

コメントは任意で大丈夫です。

コマンドを実行すると鍵ファイルをどこに保存するか聞かれるので、
保存先が問題なければenterを押してください。

そのあと、キーにパスを設定するか聞かれるので(2回)、
パスなしにするのであれば2回ともenterを押してください。

これでキーペアが作成されました。
次はgithubに公開鍵を登録します。

githubに公開鍵登録

まずはgithubにログインしてください。

公開鍵の登録場所は、

"account setting"から設定ページにいき、
"SSH keys"にあります。

登録は簡単。
titleを入力し、先ほど作成した公開鍵(~/.ssh/id_rsa.pub)を
コピペするだけです。

以上で完了です!!

tips

デフォルトのビット数は2048ビットに設定されています。
ビット数を指定するには "-b" オプションを使用してください。

7
9
0

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
7
9