how to copy contents of ssh key into clipboard

Shell
pbcopy < ~/.ssh/id_rsa.pub clip < ~/.ssh/id_rsa.pub
Source

Also in Shell: