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
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
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.
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
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.
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
You need to set up credential helper at gloal config level.
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
Once all of above steps are completed, you are ready to clone CodeCommit repository without giving password each time.
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
post by Pravin