エラー内容
$ git clone ssh://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/xxxxxxxx Cloning into 'xxxxxxxx'... yoshiyuki_sakamoto@git-codecommit.ap-northeast-1.amazonaws.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
解決方法
.ssh/config
に以下を書く必要がある
Host git-codecommit.*.amazonaws.com User <SSHキーID> IdentityFile ~/.ssh/id_rsa
SSHキーIDは
- AWS コンソールから IAM にアクセス
- 「ユーザー」から自分を選択して
- 「認証情報」にある「AWS CodeCommit の SSH キー」の「SSH キー ID」を入れる
以上。
$ git clone ssh://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/xxxxxxxx Cloning into 'xxxxxxxx'... remote: Counting objects: 237, done. Receiving objects: 100% (237/237), 262.43 KiB | 4.60 MiB/s, done. Resolving deltas: 100% (76/76), done.
無事cloneできた。