
Photo by
mericanadesico
Git, GitHubのssh接続
SSH通信の設定
流れとしては、
ターミナル上でsshキーを発行、公開鍵をコピー -> GitHubの自分の設定ページにて、新しい鍵を登録、先ほどのキーをペースト。まずは既にキーを作ったことがあるかどうか確認。
<Ubuntu>
# check if ssh key already exist
$ cd ~/.ssh
# if you moved in ssh directory, you can copy rsa pub key
$ cat id_rsa.pub
# or delete key and reset it.
<Ubuntu>
# generate ssh key repository and keys
$ ssh-keygen
この時どこに保存するか聞かれるが、何も入力せずにenter.
生成されたsshキーのあるリポジトリに移動し、公開キーを表示させ、コピーする。
<Ubuntu>
# move into ssh repo
$ cd ~/.ssh
# display rsa pub key
$ cat id_rsa.pub
自分のGitHubページに移動する。検索バー右にあるコマンドパレットでsshと入力すると一発で目的のページに飛べる。


'New SSH Key' をクリックし、わかりやすい名前を付けたうえで、先ほどコピーしたrsa pubキーを'Key'欄び貼り付けて'Add SSH Key'する。
ターミナルに戻り、接続をテストする。
<Ubuntu>
# test connection
$ ssh -T git@github.com
# e.g. response
# Hi <name>!, You've successfully authenticated,...