Know How Guide and Hands on Guide for AWS
Get clone url from:
git clone https://git-codecommit.cn-northwest-1.amazonaws.com.cn/v1/repos/MyDemoRepo
git clone codecommit::cn-northwest-1://MyDemoRepo
git clone ssh://git-codecommit.cn-northwest-1.amazonaws.com.cn/v1/repos/MyDemoRepo
create the new IAM user with AWSCodeCommitPowerUser permission or you can use the existed user by check/add AWSCodeCommitPowerUser permission
Create Git Credentials for HTTPS Connections to CodeCommit
Working on CodeCommit Reposiotry Get Start Codecommit
create the new IAM user with AWSCodeCommitPowerUser permission or you can use the existed user by check/add AWSCodeCommitPowerUser permission
To install and configure the AWS CLI ```bash aws codecommit help
aws configure
3. Install git-remote-codecommit
```bash
pip install git-remote-codecommit
.....
Successfully built git-remote-codecommit
Installing collected packages: git-remote-codecommit
Successfully installed git-remote-codecommit-1.13
You may encounter below error when run git clone codecommit://MyDemoRepo
The following AWS Region is not available for use with AWS CodeCommit: cn-northwest-1. For more information about CodeCommit's availability in AWS Regions, see the AWS CodeCommit User Guide. If an AWS Region is listed as supported but you receive this error, try updating your version of the AWS CLI or the AWS SDKs.
Workaround:
edit the file
<YOUR_CURRENT_PYTHON_DIR>/site-packages/git_remote_codecommit/__init__.py
locate the line:
available_regions = [region for partition in session.get_available_partitions() for region in session.get_available_regions('codecommit', partition)]
(Added in >>>) available_regions.append("cn-north-1")
(Added in >>>) available_regions.append("cn-northwest-1")
Clone your repository
# with default aws configure profile
git clone codecommit://MyDemoRepo
Cloning into 'MyDemoRepo'...
remote: Counting objects: 20, done.
Unpacking objects: 100% (20/20), done.
# with a specific aws configure profile
git clone codecommit://cn-north-1@MyDemoRepo
Cloning into 'MyDemoRepo'...
remote: Counting objects: 20, done.
Unpacking objects: 100% (20/20), done.
# with profile and region
git clone codecommit::cn-northwest-1://cn-north-1@MyDemoRepo
Cloning into 'MyDemoRepo'...
remote: Counting objects: 20, done.
Unpacking objects: 100% (20/20), done.
cat ~/.ssh/codecommit_rsa.pub
2. In the IAM console, choose your `IAM user`.
- Choose the `Security Credentials` tab, and then choose `Upload SSH public key`.
- Paste the `contents of your SSH public key` into the field, and then choose `Upload SSH public key`.
- Copy or save the information in `SSH Key ID`.
![codecommit-ssh-key-upload](/aws-is-how/devops/codecommit/media/codecommit-ssh-key-upload.png)
![codecommit-ssh-key-value](/aws-is-how/devops/codecommit/media/codecommit-ssh-key-value.png)
3. Edit ~/.ssh/config by add below line
```bash
Host git-codecommit.*.amazonaws.com.cn
User {SSH Key ID}
IdentityFile ~/.ssh/codecommit_rsa
ssh -v git-codecommit.cn-northwest-1.amazonaws.com.cn
git clone ssh://git-codecommit.cn-northwest-1.amazonaws.com.cn/v1/repos/MyDemoRepo ```