How To Setup Codecommit Connection From Local


If you want to use CodeCommit, you will have to provide credentials every time you push or pull the code from repository, however you can configure your aws account on local machine you you just simply push and ull without giving user and password each time. Please following below steps ## Step#1 Provide access User need to have access to CodeCommit before you do any operation. If you are using your rot user then it already has required access but if you have created separate user, you need to grant policy `AWSCodeCommitPowerUser` to user ## Step#2 Install and configure the AWS CLI On your local machine, download and install the AWS CLI. This is a prerequisite for interacting with CodeCommit from the command line. AWS recommendsto install AWS CLI version 2. ```bash curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install ``` If `unzip` does not run, please install `sudo apt install unzip` ## Step#3 aws configure This is fairly simple process. Just type `aws config` and it will as for your aws access key and aws secret access key and other details. ```bash AWS Access Key ID [None]: Type your IAM user AWS access key ID here, and then press Enter AWS Secret Access Key [None]: Type your IAM user AWS secret access key here, and then press Enter Default region name [None]: Type a supported region for CodeCommit here, and then press Enter. I used ap-south-1 Default output format [None]: Type json here, and then press Enter. I used json ``` ## Step#4 Credential helper You need to set up credential helper at gloal config level. ```bash git config --global credential.helper '!aws codecommit credential-helper $@' git config --global credential.UseHttpPath true ``` ## Step#5 Git clone Once all of above steps are completed, you are ready to clone CodeCommit repository without giving password each time. ```bash git clone https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo my-demo-repo ``` If you run into any issue while following this up, please let me know. Aletrnatively, you can refer to more detailed aws documentation [here](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html)

This post is written by Pravin

Tags : Git AWS

Share it :      

Leave a comment

captcha


Tags

Elsewhere

  1. GitHub
Ad below