AWS CodeCommit: Repository does not exist

in Development


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

  1. 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.

  2. 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"

  3. Try connecting. If your repo is in git-codecommit.eu-north-1.amazonaws.com, then simply run ssh 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.

  4. Try running git fetch. If it still doesn't work, you may be using multiple users in your ~/.ssh/config under Host git-codecommit.*.amazonaws.com wildcard, and a wrong one must be matching. Try changing your remote from ssh://git-codecommit.eu-north-1.amazonaws.com/v1/repos/myrepo to ssh://SSH_KEY_ID@git-codecommit.eu-north-1.amazonaws.com/v1/repos/myrepo

#aws #git