Permanently added the RSA host key for IP address
Warning: Permanently added the RSA host key for IP address '[ip address]' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
対処法
$ ssh-keygen -R '[ip address]' 
Please make sure you have the correct access rights
$git clone git@github.com:xxxxxx/xxxxx.git
Cloning into 'docker-elk'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
対処法
鍵を生成
$ ssh-keygen -t rsa -C [mail address]
Enter file in which to save the key (/home/vagrant/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/[pc name]/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/[pc name]/.ssh/id_rsa.
Your public key has been saved in /Users/[pc name]/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:[hash] [mail address]
The key's randomart image is:
+---[RSA 3072]----+
|      o o.E      |
|     o . .       |
|    x x     .    |
|     x x   x .   |
|    * * x + + .  |
|   o = . x = . . |
|    . ..+x+ . .  |
|       +xxx* o . |
|       =BBBo=..  |
+----[SHA256]-----+
(一応適当に書き換えてあります)
鍵をコピー
$ less ~/.ssh/id_rsa.pub
ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [mail address]
[mail address]以外の部分をコピーする
github settingへ遷移
「New SSH Key」を押下
鍵を追加
疎通確認
ターミナルに戻り疎通を確認する
$ vim ~/.ssh/config 
Host github
  HostName github.com
  IdentityFile ~/.ssh/id_rsa
  User git
これを貼り付ける
ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '[ip address]' to the list of known hosts.
Enter passphrase for key '/Users/[pc name]/.ssh/id_rsa': 
Hi [git config name]! You've successfully authenticated, but GitHub does not provide shell access.
こんな感じの、successfullyメッセージが表示されたら完了。


