简体   繁体   中英

git clone ASW codecommit

Im following https://aws.amazon.com/getting-started/hands-on/build-serverless-web-app-lambda-apigateway-s3-dynamodb-cognito/module-1/ facing issue on "Create a Git repository" on point "G". getting below error

"git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/wildrydes-site Cloning into 'wildrydes-site_new'... fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/wildrydes-site/': The requested URL returned error: 403"

This error code is typically associated with authentication or authorization issues.

To resolve this issue, you will need to ensure that the IAM user or role that you are using to authenticate to the CodeCommit repository has the appropriate permissions. This includes the necessary permissions to access the repository and to perform the Git operations that you are trying to perform.

Additionally, make sure your IAM user has the AWSCodeCommitFullAccess permission policy.

You can also try to use the HTTPS credentials helper, which allows Git to use the AWS credentials in your environment to authenticate with CodeCommit.

You can install the AWS CLI on your system and then run aws configure to set your credentials. After that you can use the git credential helper by running git config --global credential.helper '!aws codecommit credential-helper $@'

Refer to https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-unix.html for more details on how to set up the Git credentials helper.

Make sure your IAM user or role being used has codecommit:GitPull permissions or you can attach the managed policy AWSCodeCommitPowerUser to provide more wider codecommit access.

Approach 1 for IAM Users using Git Credentials

You need to setup IAM credentials like they mentioned in point 'e'. Follow the instructions here to generate codecommit credentials for your IAM User.

The generated credentials will have a username and password with the username in the format <your-iam-username>-at-<account id> . Make sure to copy the password or download the credentials file. Use these username and password values when you run git clone command.

Approach 2 for IAM roles or users.

You need to configure your IAM user aws credentials locally using aws configure or If you are using roles, you need to run aws sts assume-role --role-arn <role-arn> to assume the role after aws configure and generate the temporary credentials which you can export to your environment.

Once the aws credentials configuration is done, you can run below commands to use AWS CLI as your credential helper.

git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true

Run your git clone after running above commands. That should fix your issue too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM