Problem
Repository does not exist fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Solution
-
Follow the official documentation: create a new IAM user and set up the SSH keys for that user. Alternatively, go to your repo and click Clone -> Connection Steps to get to the documentation.
-
Configure your local computer's or your server's
~/.ssh/config
: add your CodeCommit hostname, specify your user account name a.k.a. IAM SSH Key ID. Make sure you're using the "SSH keys for AWS CodeCommit" and not "Access Keys" -
Try connecting. If your repo is in
git-codecommit.eu-north-1.amazonaws.com
, then simply runssh git-codecommit.eu-north-1.amazonaws.com
and the response should be:You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.eu-north-1.amazonaws.com closed by remote host. Connection to git-codecommit.eu-north-1.amazonaws.com closed.
-
Try running
git fetch
. If it still doesn't work, you may be using multiple users in your~/.ssh/config
underHost git-codecommit.*.amazonaws.com
wildcard, and a wrong one must be matching. Try changing your remote fromssh://git-codecommit.eu-north-1.amazonaws.com/v1/repos/myrepo
tossh://SSH_KEY_ID@git-codecommit.eu-north-1.amazonaws.com/v1/repos/myrepo