Published on: January 12, 2022 by Vinayan C V
Scenario:
In this article we are creating a local copy of the CodeCommit repository which we are creating in AWS, and making some changes to it. Then we push the changes to the AWS CodeCommit repository.
Step-by-step guide
Setup for HTTPS users using Git credentials.
1. Create an AWS CodeCommit Repository.
On the Create repository page, in Repository name, enter a name for your repository. Other fields are optional.
2. Creating Local repository in our system from AWS CodeCommit repo.
Choose Clone URL, and then choose the protocol you want to use when cloning or connecting to the repository.
There are three protocols:
-Copy the HTTPS URL if you are using either Git credentials with your IAM user or the credential helper included with the AWS CLI.
-Copy the HTTPS (GRC) URL if you are using the git-remote-codecommit command on your local computer.
-Copy the SSH URL if you are using an SSH public/private key pair with your IAM user.Here we are using HTTPS URL,
- Create an IAM user with CodeCommit access and generate HTTPS Git credentials, since git https credentials will be asked when running git clone.
2.1. Sign in to the AWS Management Console and open the IAM console to create CodeCommit user.
2.2. In the IAM console, in the navigation pane, choose Users, and then choose Add user or select existing user.
2.3. In Grant permissions, choose Attach existing policies directly.
2.4. After you have selected the policy you want to attach, choose Next: Review to review the list of policies to attach to the IAM user.
- Generate HTTPS Git credentials for CodeCommit user.
git clone https://git-codecommit.us-east-2.amazonaws.com/v1/repos/test
Now you have the local repo with exact copy of CodeCommit repo.
In Grant permissions, choose Attach existing policies directly.
git config --local user.name "your-user-name" git config --local user.email your-email-address
git status
git add .
git commit -m "Message to commit"
git push -u origin master
In this step, you push the commit from your local repo to your CodeCommit repository. you can view the changes in AWS. CodeCommit user authentication is needed here.
Setup steps for SSH connections to AWS CodeCommit repositories
cat ~/.ssh/codecommit_rsa.pub
Copy this value to the clipboard.
Host git-codecommit.*.amazonaws.com User APKA4RVIFCYLNQJMQFFA IdentityFile ~/.ssh/codecommit_rsa
chmod 600 config
ssh git-codecommit.us-east-2.amazonaws.com
Get rid of all the hassles
CONTACT OUR DEVOPS TEAM WITH YOUR REQUIREMENTS!
Category : Linux
Add new commentSIGN IN