git clone repository from Windows to AWS Code Commit error, Permission denied, fatal: Could not read from remote repository..
Example Error Command:
$ git clone ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-code-repository
Error:
Cloning into 'my-code-repository'...
ramis@git-codecommit.us-east-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.
Solution Prerequisites:
- SSH Key created for Windows and in ~/.ssh folder
- SSH Public Key has been uploaded in AWS > IAM > User > Robert > Security Credentials > SSH keys for AWS CodeCommit
Solution:
You have to specify the SSH-KEYID from AWS IAM Account in the git clone
$ git clone ssh://{SSH-KEYID}@git-codecommit.us-east-1.amazonaws.com/v1/repos/{RepositoryName}
Example:
$ git clone ssh://BZRSTYKLXIY6X4RUOKYL@git-codecommit.us-east-1.amazonaws.com/v1/repos/my-code-repository