AWS CodeCommit is no longer available to new customers. Existing customers of
AWS CodeCommit can continue to use the service as normal.
Learn more"
Create an AWS CodeCommit repository
Use the AWS CodeCommit console or the AWS Command Line Interface (AWS CLI) to create an empty CodeCommit repository. To add tags to a respository after you create it, see Add a tag to a repository.
These instructions assume that you have completed the steps in Setting up .
Note
Depending on your usage, you might be charged for creating or accessing a repository. For more information, see
Pricing
Create a repository (console)
To create a CodeCommit repository
Important
Creating a repository in AWS CodeCommit is no longer available to new customers. Existing customers of
AWS CodeCommit can continue to use the API as normal.
Learn more"
Open the CodeCommit console at https://console.aws.amazon.com/codesuite/codecommit/home
. -
In the region selector, choose the AWS Region where you want to create the repository. For more information, see Regions and Git connection endpoints.
-
On the Repositories page, choose Create repository.
-
On the Create repository page, in Repository name, enter a name for the repository.
Note
Repository names are case sensitive. The name must be unique in the AWS Region for your Amazon Web Services account.
-
(Optional) In Description, enter a description for the repository. This can help you and other users identify the purpose of the repository.
Note
The description field displays Markdown in the console and accepts all HTML characters and valid Unicode characters. If you are an application developer who is using the
GetRepository
orBatchGetRepositories
APIs and you plan to display the repository description field in a web browser, see the CodeCommit API Reference. -
(Optional) Choose Add tag to add one or more repository tags (a custom attribute label that helps you organize and manage your AWS resources) to your repository. For more information, see Tagging repositories in AWS CodeCommit.
-
(Optional) Expand Additional configuration to specify whether to use the default AWS managed key or your own customer managed key for encrypting and decrypting data in this repository. If you choose to use your own customer managed key, you must ensure that it is available in the AWS Region where you are creating the repository, and that the key is active. For more information, see AWS Key Management Service and encryption for AWS CodeCommit repositories.
-
(Optional) Select Enable Amazon CodeGuru Reviewer for Java and Python if this repository contains Java or Python code, and you want CodeGuru Reviewer to analyze it. CodeGuru Reviewer uses multiple machine learning models to find code defects and to suggest improvements and fixes in pull requests. For more information, see the Amazon CodeGuru Reviewer User Guide.
-
Choose Create.
After you create a repository, you can connect to it and start adding code either through the CodeCommit console or a local Git client, or by integrating your CodeCommit repository with your favorite IDE. For more information, see Setting up for AWS CodeCommit. You can also add your repository to a continuous delivery pipeline. For more information, see Simple Pipeline Walkthrough.
To get information about the new CodeCommit repository, such as the URLs to use when cloning the repository, choose the repository's name from the list, or just choose the connection protocol you want to use next to the repository's name.
To share this repository with others, you must send them the HTTPS or SSH link to use to clone the repository. Make sure they have the permissions required to access the repository. For more information, see Share a repository and Authentication and access control for AWS CodeCommit.
Create a repository (AWS CLI)
You can use the AWS CLI to create a CodeCommit repository. Unlike the console, you can add tags to a repository if you create it using the AWS CLI.
Important
Creating a repository in AWS CodeCommit is no longer available to new customers. Existing customers of
AWS CodeCommit can continue to use the API as normal.
Learn more"
-
Make sure that you have configured the AWS CLI with the AWS Region where the repository exists. To verify the Region, run the following command at the command line or terminal and review the information for default region name.
aws configure
The default region name must match the AWS Region for the repository in CodeCommit. For more information, see Regions and Git connection endpoints.
-
Run the create-repository command, specifying:
-
A name that uniquely identifies the CodeCommit repository (with the
--repository-name
option).Note
This name must be unique across an Amazon Web Services account.
-
An optional comment about the CodeCommit repository (with the
--repository-description
option). -
An optional key-value pair or pairs to use as tags for the CodeCommit repository (with the
--tags
option). -
An optional customer managed key to use when encrypting and decrypting this repository. All repositories are encrypted in transit and at rest using a key in AWS KMS. If no key is specified, the default AWS managed key
aws/codecommit
is used.
For example, to create a CodeCommit repository named
MyDemoRepo
with the description"My demonstration repository"
and a tag with a key namedTeam
with the value ofSaanvi
, use this command.aws codecommit create-repository --repository-name MyDemoRepo --repository-description "My demonstration repository" --tags
Team
=Saanvi
Note
The description field displays Markdown in the console and accepts all HTML characters and valid Unicode characters. If you are an application developer who is using the
GetRepository
orBatchGetRepositories
APIs and you plan to display the repository description field in a web browser, see the CodeCommit API Reference. -
-
If successful, this command outputs a
repositoryMetadata
object with the following information:-
The description (
repositoryDescription
). -
The unique, system-generated ID (
repositoryId
). -
The name (
repositoryName
). -
The ID of the Amazon Web Services account associated with the CodeCommit repository (
accountId
).
The following is example output, based on the preceding example command.
{ "repositoryMetadata": { "repositoryName": "
MyDemoRepo
", "cloneUrlSsh": "ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo
", "lastModifiedDate": 1446071622.494, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo
", "defaultBranch": main, "kmsKeyId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "creationDate": 1446071622.494, "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "Arn": "arn:aws:codecommit:us-east-2:111111111111:MyDemoRepo", "accountId": "111111111111" } }Note
Tags that were added when the repository was created are not returned in the output. To view a list of tags associated with a repository, run the list-tags-for-resource command.
-
-
Make a note of the name and ID of the CodeCommit repository. You need them to monitor and change information about the CodeCommit repository, especially if you use AWS CLI.
If you forget the name or ID, follow the instructions in View CodeCommit repository details (AWS CLI).
After you create a repository, you can connect to it and start adding code. For more information, see Connect to a repository. You can also add your repository to a continuous delivery pipeline. For more information, see Simple Pipeline Walkthrough.