AWS Code Commit - How To setup
We are using AWS platform for our data warehouse, so we wanted to use AWS-Code-Commit for our source control. Its a private git repository on the AWS platform and its very easy to use.
Now start to clone, branch, push, pull, merge and so on on your AWS-CC repositories.
- Install local git in your Local working machine
- For Linux : sudo yum install git-all
- For Windows- Download git https://git-scm.com/downloads and install it.
- When the installation is done, then type the below to check if the installation was successful
- Install AWS CLI
- If you are already working with AWS platform then you should have already installed it. If yes good, else install it. To check if it is already installed or not type the "help" command as given below.
- For windows – download and install from -http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-msi-on-windows
- For Linux - http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-bundle-other-os
- Finally type this command to make sure you have installed the AWS CLI –
- Git Setup for AWS-code-commit
- I’m planning to connect to AWS-code-commit repositories using https because https is easy when working with windows plus I can follow the same process for both window and linux. But if you would prefer SSH then please go ahead. More details are provided here – http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up.html
- Make sure your IAM user permission to access the AWS-CC repositories.
- Get "aws_access_key_id" and "aws_secret_access_key" ( this is required so that you don’t have to enter your username and pwd all the time to connect to AWS-code-commit )
- Set Up .gitconfig
- Open up the cmd / shell and type in the below command
- Now you should see a file “.gitconfig” in your home directory
- (linux) ~/.gitconfig
- (windows) C:\Users\< username >\.gitconfig
- Open and edit the “.gitconfig” file to add the Developer "name" and "email". This is the name and email which will be used for all your commit and push to AWS-Code-Commit. the file will look like this.
- Set Up .aws/credentials
- Open up the .aws/credentials and update the aws_access_key_id and aws_secret_access_key that you got in step 3 under a separate profile "CodeCommitProfile"
- Windows (C:\Users\
.aws\credentials) Linux(~/.aws/credentials) - Please note that at the time of this document AWS-CC is available only in N.Virginia region. so add the region as us-east-1
git help
aws help
git config --global credential.helper '!aws --profile CodeCommitProfile codecommit credential-helper $@' git config --global credential.UseHttpPath true
[user] name = Venkat.V.S. email = [your email id] [credential] helper = !'C:\\Users\\subramanianv\\AppData\\Roaming\\GitCredStore\\git-credential-AWSSV4.exe' --profile=CodeCommitProfile UseHttpPath = true
[CodeCommitProfile] aws_access_key_id = [your key] aws_secret_access_key = [your secret key] output =JSON region =us-east-1
Comments