Git Remote CodeCommit
git-remote-codecommit is a Git remote helper that simplifies interaction with AWS CodeCommit repositories by enabling a `codecommit://` URL prefix. It leverages existing AWS CLI credential profiles for authentication, supporting features like multiple AWS accounts and temporary credentials without caching them in the operating system's credential store. This tool is the recommended approach for connecting to CodeCommit with federated access or IAM roles. The current version is 1.17, with irregular but ongoing releases indicating active maintenance.
Warnings
- gotcha This is a Git remote helper, not a Python library for direct `import`. It extends Git's capabilities rather than providing Python APIs for programmatic interaction.
- breaking AWS CLI `v2.9.x` introduced new `~/.aws/config` file formats that `git-remote-codecommit` might fail to recognize, leading to authentication issues.
- gotcha Many IDEs (Integrated Development Environments) may not fully support Git remote helpers like `git-remote-codecommit` for cloning, pushing, or pulling. This can result in 'invalid URL' or connection errors within the IDE.
- gotcha Encountering 'fatal: Unable to find remote helper for 'codecommit'' indicates that the `git-remote-codecommit` executable is not correctly installed or not in your system's PATH.
- gotcha If `pip install git-remote-codecommit` fails with an 'externally managed environment' error, it's typically because you're trying to install into a system-managed Python installation.
- gotcha Authentication errors (e.g., 403 Forbidden) often stem from misconfigured or expired AWS CLI credentials, or a mismatch between the configured AWS region and the CodeCommit repository's region.
Install
-
pip install git-remote-codecommit -
brew install git-remote-codecommit
Imports
- N/A
This is a Git remote helper, not a Python library designed for direct import into Python code.
Quickstart
# 1. Ensure AWS CLI is installed and configured (e.g., 'aws configure') # For specific profiles: aws configure --profile my-codecommit-profile # 2. Clone a CodeCommit repository using the 'codecommit://' protocol # Syntax: git clone codecommit::[region]://[profile@]repository-name # Example with default profile (configured in ~/.aws/credentials) git clone codecommit://MyDemoRepo # Example with a named profile and specific region git clone codecommit::us-east-1://my-codecommit-profile@MyAnotherRepo # After cloning, standard git pull/push commands work as usual cd MyDemoRepo git pull origin main echo "Hello from CodeCommit!" > README.md git add README.md git commit -m "Add README" git push origin main