Skip to content

Instantly share code, notes, and snippets.

@3panda
Last active October 14, 2018 05:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3panda/33c17597933b921fb4fb666325ca0d9d to your computer and use it in GitHub Desktop.
Save 3panda/33c17597933b921fb4fb666325ca0d9d to your computer and use it in GitHub Desktop.
GitHubにSSH接続するための設定メモ

たまにしか行わない作業なので忘備録 ※必要があれば随時追加

秘密鍵の作成

# 鍵の格納先へ移動して
cd ~/ssh

# 鍵の作成
ssh-keygen -t rsa
Generating public/private rsa key pair.

# パスフレーズを聞かれる
# 三回同じパスを入れる(もしくはエンターを三回押す)
Enter file in which to save the key (/Users/(username)/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

GitHub へ作成した公開鍵を登録

GitHub のSSH設定ページへ移動

「New SSH Key」ボタンを押す

「Title」には何のSSH接続のための公開鍵なのか記述

「key」には公開鍵(~/.ssh内の.pubファイルの中身)を入力し登録

SSH接続の確認

ssh -T git@github.com

# パスフレーズを設定している場合ここで確認される
Enter passphrase for key '/Users/(username)/.ssh/id_rsa':
# 成功すると以下の結果が返ってくる
Hi (gitのアカウント名)! You've successfully authenticated, but GitHub does not provide shell access.

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment