View a markdown version of this page

Use CreateRepository with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use CreateRepository with a CLI

The following code examples show how to use CreateRepository.

CLI
AWS CLI

To create a repository

The following create-repository example creates a repository and associates it with the user's AWS account.

aws codecommit create-repository \ --repository-name MyDemoRepo \ --repository-description "My demonstration repository"

Output:

{ "repositoryMetadata": { "repositoryName": "MyDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-west-2.amazonaws.com/v1/repos/MyDemoRepo", "lastModifiedDate": 1444766838.027, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://git-codecommit.us-west-2.amazonaws.com/v1/repos/MyDemoRepo", "repositoryId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "Arn": "arn:aws:codecommit:us-west-2:123456789012:MyDemoRepo", "accountId": "123456789012" } }

For more information, see Create an AWS CodeCommit repository in the AWS CodeCommit User Guide.

PowerShell
Tools for PowerShell V4

Example 1: This example creates a new repository with the specified name and the specified description.

New-CCRepository -RepositoryName MyDemoRepo -RepositoryDescription "This is a repository for demonstration purposes."

Output:

AccountId : 80398EXAMPLE Arn : arn:aws:codecommit:us-east-1:80398EXAMPLE:MyDemoRepo CloneUrlHttp : https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CloneUrlSsh : ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CreationDate : 9/18/2015 4:13:25 PM DefaultBranch : LastModifiedDate : 9/18/2015 4:13:25 PM RepositoryDescription : This is a repository for demonstration purposes. RepositoryId : 43ef2443-3372-4b12-9e78-65c27EXAMPLE RepositoryName : MyDemoRepo
  • For API details, see CreateRepository in AWS Tools for PowerShell Cmdlet Reference (V4).

Tools for PowerShell V5

Example 1: This example creates a new repository with the specified name and the specified description.

New-CCRepository -RepositoryName MyDemoRepo -RepositoryDescription "This is a repository for demonstration purposes."

Output:

AccountId : 80398EXAMPLE Arn : arn:aws:codecommit:us-east-1:80398EXAMPLE:MyDemoRepo CloneUrlHttp : https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CloneUrlSsh : ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CreationDate : 9/18/2015 4:13:25 PM DefaultBranch : LastModifiedDate : 9/18/2015 4:13:25 PM RepositoryDescription : This is a repository for demonstration purposes. RepositoryId : 43ef2443-3372-4b12-9e78-65c27EXAMPLE RepositoryName : MyDemoRepo
  • For API details, see CreateRepository in AWS Tools for PowerShell Cmdlet Reference (V5).