i tried to set up git client to work with AWS CodeCommit

2021.09.29

Overview:

to set up Git client to work with AWS CodeCommit. According to the AWS documentation, the simplest way to set up connections to AWS CodeCommit repositories is to configure Git credentials for CodeCommit in the IAM console, and then use those credentials for HTTPS connections. To setup for HTTPS users using Git credentials

Create an IAM user for accessing CodeCommit

  • creating a user from IAM Service
    • adduser
      • user name: xyz
      • access type: programatic access and Password - AWS Management Console access
  • attaching following existingpolicies

    • IAMReadOnlyAccess
    • IAMSelfManagedServiceSpecificCredentials
    • AWSCodeCommitFullAccess
  • create user and download csv file with access key and secret access key

Install Git

  • depends on the OS you can download git from link:download git
  • install it with default configuration

 

Setup HTTPS Git credentials for CodeCommit

  1. In an iam console select user created before "xyz"
  2. select security credentials
  3. In HTTPS Git credentials for CodeCommit:select generate credentials
  4. download credentials

Create a CodeCommit repository

  • From a services in developers tool select CodeCommit
  • select repository from dashboard and click create repository
    • repository name : xyz
    • discription : xyz
  • click create
  • after creation of repository we will get the steps for connecting to the repository and clone url

Clone your CodeCommit repository to your local computer

  • open git bash and change the directory where you want to work for eg:-
cd /c/users/Admin/Desktop

 

  • clone the repository from the clone url  for the first time it will ask for Git Credential Manager id and password:
    • username : copy the username from HTTPS Git credentials for CodeCommit csv file
    • passsword : copy the username from HTTPS Git credentials for CodeCommit csv file
  • you will get the empty folder
  • use basic git command for working with repository
git add filename.txt

git commit -m "commit message"

git push

for more git command refer the below link

basic-git-commands

Reference

https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html

Finally

We can work seamlessly with our existing Git-based tools as it supports the standard functionality of Git Till the Next time happy Learning!