Tomasz Kapłoński
Tomasz Kapłoński

Reputation: 1378

Access existing repository on CodeCommit

I have been invited to some project that has a repository stored in AWS CodeCommit. I received Access Key ID, Secret Key, region and repository url... I created an account in AWS (I didn't have one before) and created a new IAM user with AWSCodeCommitFullAccess privilege but I have no idea how to bind this user with a repository I was given. The console available at https://console.aws.amazon.com/codecommit/home points me to documentation or allows to create an empty repository and the access keys panel in IAM allows me only to create new Access Keys but not provide existing ones... How can I get to some existing repository then? Maybe the owner needs to do something as well?

Upvotes: 1

Views: 1354

Answers (2)

Kush Vyas
Kush Vyas

Reputation: 6109

Try ti Follow these steps:

To install and configure the AWS CLI:

  • On your local machine, download and install the AWS CLI. This is a prerequisite for interacting with AWS CodeCommit from the command line. ( install Latest Version Following this Guide )
  • Run this command to verify the AWS CodeCommit commands for the AWS CLI are installed: aws codecommit help

    This command should return a list of AWS CodeCommit commands.

  • Configure the AWS CLI with the configure command, as follows aws configure

When prompted, specify the AWS access key and AWS secret access key of the IAM user you got from.

Also, be sure to specify the region where the repository exists, such as us-east-2. When prompted for the default output format, specify json. For example:

AWS Access Key ID [None]: Type your target AWS access key ID here, and then press Enter

AWS Secret Access Key [None]: Type your target AWS secret access key here, and then press Enter

Default region name [None]: Type a supported region for AWS CodeCommit here, and then press Enter

Default output format [None]: Type json here, and then press Enter`

Next Assuming you have Git Pre-installed on your machine Set Up the Credential Helper :

  • From the terminal, use Git to run git config, specifying the use of the Git credential helper with the AWS credential profile, and enabling the Git credential helper to send the path to repositories: git config --global credential.helper '!aws codecommit credential-helper $@' git config --global credential.UseHttpPath true

Now you can connect to your git they way you do normally, refer this AWS Documentation for more details.

Upvotes: 2

baochenAws
baochenAws

Reputation: 24

It seems you want to contribute to a repository that already have existed in another account. To access the repository data by doing 'git clone', the provided "Access Key ID, Secret Key, region and repository url." should be sufficient. But you have to use the aws cli credential helper by following the instruction here: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-unixes.html. There are other ways as well to access the repository, please take a look at the doc here: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up.html.

If you want to check the code via AWS console, you can access the console by using this url: https://[account_id].signin.aws.amazon.com/console (replace the account_id with the account id where the repository belongs to). And you need to provide the username and console login password of the IAM user that have permission to read the codecommit repository.

Upvotes: 0

Related Questions