git clone でリモートリポジトリを読み込もうとした際にエラーが発生。
git clone git@github.com:git-repository-url
user.name@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
公開鍵がGithubに登録されているか確認 → されていた。
私の場合は、~/.ssh 下で作成していたconfigファイルが影響を与えていた。
Host github-account1
AddKeysToAgent yes
UseKeychain yes
HostName github.com
Preferredauthentications publickey
IdentityFile ~/.ssh/id_rsa
User account1
github.comを既にホストに割り当てている場合は、以下のコマンドを実行することで正常に動作した。
git clone git@github-account1:git-repository-url
cloneやpush関係で問題が起こったら一度configをチェックしてみようという話。
※ちなみにこの方法だとhttpsからgit cloneは可能ではない。
わかり次第追記。