DEV Community

farzana-juthi for AWS Community Builders

Posted on • Updated on • Originally published at Medium

How to setup HTTPS users to upload code into codecommit using git credential

CodeCommit is a fully managed source control service that makes it easy to host secure and highly scalable private Git repositories. CodeCommit eliminates the need to operate your own source control system or worry about scaling its infrastructure. You can use CodeCommit to securely store anything from source code to binaries, and it works seamlessly with your existing Git tools.

code commit

Prerequisites:

  1. Install git: To install Git, we recommend websites such as Git Downloads .

  2. Create IAM user and give permission: If you don’t know how to create IAM user and give permission for aws services, then please check this reference post. You need to follow the steps from 1–9.

Create Git credentials for HTTPS connection to CodeCommit:

  • If you have an IAM user, please go that “user” page from left menu and select the checkbox of the user where you want to configure “HTTPS Git credentials for AWS CodeCommit”. Then select “Security credentials” tab of this page.

security credential

  • Then click on “Generate credentials” button.

Generate credential

  • It will generate username and password like the following image. Download the credentials for further use. This credential will be used in the gitlab mirroring repository section.

Download credential

Create CodeCommit repository and link it to gitlab code:

  • Search CodeCommit in aws console and click on it. You will find an option to create repository like following image:

Search CodeCommit

  • Then click on “Create repository” button and fill up the following fields:

Create repository

  • Here I am giving tutorial-app as repository name. You have to give your repository name here and click on “Create” button.

  • Then you will see newly created repository into your repositories list like following:

Repository

  • Then click on the radio button of “tutorial-app” repository (your repository name) and then from that page you will get following “clone url” option and select that button and choose “clone HTTPS”:

Clone URL

  • When you click on “clone HTTPS” button, you will see a link is copied like following image:

Clone HTTPS

  • You have to use this link into gitlab.

Setup mirroring gitlab code to CodeCommit:

  • First browse the link https://about.gitlab.com/ and click on the Login button and then login into the system by giving our gitlab credentials.

  • Then search your gitlab project and click on that project. Here I will use my previously created “tutorial-backend” project.

  • Then select Settings -> Repository from tutorial-backend:

Settings

  • Then click on “Expand” from “Mirroring repositories” like following image:

Expand

  • Then take the previously copied url (step no 6 from Setup mirroring gitlab code to CodeCommit section) and paste it like following image:

Copied URL

  • Then you have to use the IAM codeCommit username after “https:// ” and then “@” sign after codeCommit username like following image and also copy the IAM codecommit password into the password field. Then click on the “Mirror repository” button. (Get your codecommit username and password from step no 3 from Create Git credentials for HTTPS connection to CodeCommit section)

Gitcommit username password

  • After that click on “sync” icon in gitlab mirroring section like following:

Sync

  • After that please go to CodeCommit page from aws console and see that your code is synced to codeCommit like following image:

CodeCommit page

Top comments (0)