SSH での公開鍵認証のメモ (後で書き直す)

# client side config
$ cd ~/.ssh
$ ssh-keygen -t ed25519 -f KEY_NAME
$ pbcopy < KEY_NAME.pub
$ ssh TARGET

# server side config
$ vim authorized_keys    # Paste the public key.
$ chmod 600 authorized_keys
$ exit

# client side config
$ vim ~/.ssh/config      # Add IdentityFile field and specify the corresponding secret key.

~/.ssh/config の例は以下のようになる.

Host bitbucket.org
    User git
    Port 22
    HostName bitbucket.org
    IdentityFile ~/.ssh/bitbucket.org
    TCPKeepAlive yes
    IdentitiesOnly yes

Host gitlab.com
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/gitlab.com

プロキシの例も後で追記する.