Authenticate Git as an AWS principal
How Git authentication, repository-scoped IAM policies, and branch-level restrictions control access and changes to CodeCommit repositories. · advanced
Authentication establishes which IAM principal is making a Git request; it does not grant repository access. CodeCommit supports HTTPS Git credentials and SSH keys associated with IAM users, as well as HTTPS access backed by AWS credentials. A console password is not a Git password, and an AWS access key ID is not a CodeCommit Git username.
HTTPS Git credentials are a service-specific username and password generated for an IAM user. For SSH, upload the user's public key to IAM and configure Git's SSH connection with the assigned SSH key ID; the private key stays on the client. These methods use persistent credentials tied to an IAM user.
For temporary role credentials, use an AWS-credential-backed HTTPS method, such as git-remote-codecommit or the AWS CLI credential helper. The former is recommended for federated and temporary-credential access. The tool obtains authentication material from the configured AWS credentials; it does not create new IAM permissions. Expired role credentials must be refreshed.
| Git access method | Identity | Client authentication material |
|---|---|---|
| HTTPS Git credentials | IAM user | Generated username and password |
| SSH | IAM user | Private key and SSH key ID |
| AWS-backed HTTPS | AWS credential principal | AWS credentials, including role sessions |