• TechOps

    Need clarity?
    Chat with our experts now

    • Web Hosting SupportWeb Hosting Support
    • Helpdesk Support

      Skilled and professional 24/7 helpdesk support

    • Product Support

      Boost your product support with our expertise

    • Managed ServicesManaged Services
    • Server Management

      Don't let server issues slow you down. Let us manage them for you

    • Server Monitoring

      Safeguard your server health with our comprehensive monitoring solutions

    • Staff AugmentationStaff Augmentation
    • Hire an Admin

      Transform your business operations with our expert administrative support

    • Hire a Team

      Augment your workforce with highly skilled professional from our diverse talent pool

  • CloudOps

    Confused?
    Discuss with our sales team now.

    • Author ProfileAWS
      Well Architected Review
    • Author ProfileFinOps As a Service

      FinOps As a Service

    • Migrate

      Upgrade the journey: Migrate & Modernize seamlessly

    • Modernize

      Effortless CloudOps mastery for seamless cloud management

    • Optimize

      Efficient CloudOps: Boosting performance through optimization

    • Manage

      Simplify compliance complexities with our dedicated service

  • DevOps

    How Supportsages
    is creating an
    impact?

    View Casestudies
    • Author Profile24/7 DevOps As a Service

      Round-the-clock DevOps for uninterrupted efficiency

    • Author ProfileCI/CD Pipeline

      Automated CI/CD pipeline for seamless deployments

    • Author ProfileInfrastructure As a Code

      Crafting infrastructure with ingenious code

    • Author ProfileDevSecOps

      Integrated security in continuous DevOps practices

    • Author ProfileHire DevOps Engineers

      Level up your team with DevOps visionaries

    • Author ProfileConsulting Services

      Navigate success with expert DevOps consulting

  • SecOps

    Expert SecOps Services
    for any Scale

    • Author ProfileVAPT

      Vulnerability Assessment and Penetration Testing

    • Author ProfileSource Code Review

      Ensuring source code security and safe practices to reduce risks

    • Author ProfileSecurity Consultation

      On demand services for improving server security

    • Author ProfileSystem Hardening

      Reduced vulnerability and proactive protection

    • Author ProfileManaged SOC

      Monitors and maintains system security. Quick response on incidents

    • Author ProfileCompliance as a Service

      Regulatory compliance, reduced risk

  • Insights

    Explore our latest
    insights and resources

    Blog

    Explore our latest articles and insights

    Case Studies

    Read about our client success stories

  • Contact Us

  • About
  • Certifications
  • Life at Supportsages
  • Events
  • Contact
  • Careers
  • Blog

  • Dedicated Support Team
  • Quasi-dedicated Support Team
  • Hire a DevOps Engineer
  • Hire a Billing Support Staff
  • Per-ticket Support Plan
  • Managed Services

  • Microsoft Azure Expert
  • AWS Cloud Expert
  • Hire a developer
SS

SupportSages

Bites of wisdom @ work


Copyright © 2008 - 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

Working with Git in CodeCommit

Vinayan C V

  • 5 min read
Working with Git in CodeCommit

Generating audio, please wait...

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.

  1. Add files to see the changes happen in CodeCommit after next push.
  2. Run git config to add your username and email address. This makes it easier to identify the commits you make and others.
    git config --local user.name "your-user-name" 
    git config --local user.email your-email-address
  3. Run git status to view the changes made,
    git status

  4. Run git add to stage the change,
    git add .
  5. The git add command adds changes in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit.
  6. Run git commit to commit the change,
    git commit -m "Message to commit"

  7. Run git push to push your initial 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.

  8. Now you can view the changes/added files in the AWS CodeCommit repo.

Setup steps for SSH connections to AWS CodeCommit repositories

  1. To set up the public and private keys for Git and CodeCommit from the terminal on your local machine, run the ssh-keygen command, and follow the directions to save the file to the .ssh directory for your profile.
  2. Run the following command to display the value of the public key file (Codecommit_rsa.pub) :
    cat ~/.ssh/codecommit_rsa.pub

    Copy this value to the clipboard.

  3. In AWS IAM console, in the navigation pane, choose Users, and from the list of users, choose your IAM user you created for this CodeCommit. On the user details page, choose the Security Credentials tab, and then choose Upload SSH public key. Paste the contents of your SSH public key into the field, and then choose Upload SSH public key.
  4. Copy or save the information in SSH Key ID (for example, APKA4RVIFCYLNQJMQFFA).
  5. On your local machine, use a text editor to create a config file in the ~/.ssh directory, and then add the following lines to the file, where the value for User is the SSH key ID you copied earlier:
    Host git-codecommit.*.amazonaws.com 
    User APKA4RVIFCYLNQJMQFFA 
    IdentityFile ~/.ssh/codecommit_rsa
  6. Change the permissions for the config file:
    chmod 600 config

  7. Setup is completed and you can test your SSH configuration using the following command :
    ssh git-codecommit.us-east-2.amazonaws.com

LET US TAKE CARE OF YOUR SERVERS 24/7/365.

Get rid of all the hassles

CONTACT OUR DEVOPS TEAM WITH YOUR REQUIREMENTS!

  • Linux

Looking for AWS Experts?

We provide top-of-the-line custom AWS setup services tailored to your needs.

Amazon ECS Exec to access your containers on AWS Fargate Skip to end of metadata

Amazon ECS Exec to access your containers on AWS Fargate Skip to end of metadata
  • AWS
logo

Amazon SES Suppression List

Amazon SES Suppression List
  • AWS
logo

Azure VmScaleset Alert Configuration

Azure VmScaleset Alert Configuration
  • Linux
logo

EC2 Status check and restart using SSM runbook

EC2 Status check and restart using SSM runbook
  • Linux
logo
Working with Git in CodeCommit

Posts by Vinayan C V

Vinayan C V