Tuesday, January 18, 2022

how to authenticate code commit repositiory over the ssh protocol.

Step 1) Create a repository in code commit

Step 2) Create IAM user
                        with programmatic access
                                and attach "codecommitfullaccess
" polices.



Step 3) In Machine run few ssh commands for generating files

$ cd ~/.ssh
$ ssh-keygen -t rsa -b 2048 -C "aws-code-commit"
$ cat aws-code-commit.pub



Step 4) upload public key in IAM user 

IAM >> Security Credential >> Upload Public SSH key



Step 5) After uploading Public key (Copy "SSH key ID")



Step 6) In Machine create "config" file 

$ cd ~/.ssh
$ vim config

Step 7) Add below content in config file and paste "SSH key ID" value in USER line

HOST git-codecommit.*.amazonaws.com
                        USER APKAQCH7G7N4EQL46BFB
                        IdentityFile ~/.ssh/aws-code-commit



Step 8) Give Permission to file. 

$ chmod 600 ~/.ssh/config

Step 9) Test ssh connection 

$ ssh git-codecommit.ap-south-1.amazonaws.com



Step 10) Finally do git clone over ssh repository url


No comments:

Post a Comment

testing