Amazon CodeCommit command line reference - Amazon CodeCommit
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Amazon CodeCommit command line reference

This reference helps you learn how to use the Amazon CLI.

To install and configure the Amazon CLI

  1. On your local machine, download and install the Amazon CLI. This is a prerequisite for interacting with CodeCommit from the command line. We recommend that you install Amazon CLI version 2. It is the most recent major version of the Amazon CLI and supports all of the latest features. It is the only version of the Amazon CLI that supports using a root account, federated access, or temporary credentials with git-remote-codecommit.

    For more information, see Getting Set Up with the Amazon Command Line Interface.

    Note

    CodeCommit works only with Amazon CLI versions 1.7.38 and later. As a best practice, install or upgrade the Amazon CLI to the latest version available. To determine which version of the Amazon CLI you have installed, run the aws --version command.

    To upgrade an older version of the Amazon CLI to the latest version, see Installing the Amazon Command Line Interface.

  2. Run this command to verify that the CodeCommit commands for the Amazon CLI are installed.

    aws codecommit help

    This command returns a list of CodeCommit commands.

  3. Configure the Amazon CLI with a profile by using the configure command, as follows:.

    aws configure

    When prompted, specify the Amazon access key and Amazon secret access key of the IAM user to use with CodeCommit. Also, be sure to specify the Amazon Web Services Region where the repository exists, such as us-east-2. When prompted for the default output format, specify json. For example, if you are configuring a profile for an IAM user:

    AWS Access Key ID [None]: Type your IAM user Amazon access key ID here, and then press Enter AWS Secret Access Key [None]: Type your IAM user Amazon secret access key here, and then press Enter Default region name [None]: Type a supported region for CodeCommit here, and then press Enter Default output format [None]: Type json here, and then press Enter

    For more information about creating and configuring profiles to use with the Amazon CLI, see the following:

    To connect to a repository or a resource in another Amazon Web Services Region, you must reconfigure the Amazon CLI with the default Region name. Supported default Region names for CodeCommit include:

    • us-east-2

    • us-east-1

    • eu-west-1

    • us-west-2

    • ap-northeast-1

    • ap-southeast-1

    • ap-southeast-2

    • eu-central-1

    • ap-northeast-2

    • sa-east-1

    • us-west-1

    • eu-west-2

    • ap-south-1

    • ca-central-1

    • us-gov-west-1

    • us-gov-east-1

    • eu-north-1

    • ap-east-1

    • me-south-1

    • cn-north-1

    • cn-northwest-1

    • eu-south-1

    • ap-northeast-3

    • af-south-1

    For more information about CodeCommit and Amazon Web Services Region, see Regions and Git connection endpoints. For more information about IAM, access keys, and secret keys, see How Do I Get Credentials? and Managing Access Keys for IAM Users. For more information about the Amazon CLI and profiles, see Named Profiles.

To view a list of all available CodeCommit commands, run the following command:

aws codecommit help

To view information about a CodeCommit command, run the following command, where command-name is the name of the command (for example, create-repository):

aws codecommit command-name help

See the following for descriptions and example usage of the commands in the Amazon CLI: