githubのリポジトリにpushする際に公開鍵に関するエラーが出てpushできなかったのでメモしておきます。
Pushing to git@github.com:ユーザー名/リポジトリ名.git
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
githubの公開鍵設定の項目を読んで以下の設定を試しました。
~/.ssh/config の設定を以下に設定するとpushできました。
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
私の場合はconfigの設定を自分でカスタマイズしていたのがエラーの原因になっていたようです。