config

Host <hostname>
  HostName <domain or address>
  User <user name>
  IdentityFile <ssh-key location>
  Port <port num>
  TCPKeepAlive yes 
  ServerAliveInterval 60
  IdentitiesOnly yes
  ForwardAgent yes

ssh-keygen

$ ssh-keygen -t rsa -b 4096 -C "kawahara6514@gmail.com"
Enter file in which to save the key (/Users/khwarizmi/.ssh/id_rsa): <path to key>
Enter passphrase (empty for no passphrase): <passphrase> ※ i recommend no passphrase.

server setting

send public-key

$ ssh-copy-id -i <path to public-key> <user name>@<hostname>

server config

Host <hostname>
  HostName <domain or address>
  User <user name>

ssh-agent

$ ssh-add -K <path to key>

github setting

access https://github.com/settings/keys

copy public key

$ pbcopy < <path to public key>

config for git

Host github
  HostName github.com
  User git