Amazon clouds can support many services like web servers, Networkings,Development tools, Database servers, Mobile Services, etc. this post describe configure AWS-codecommit on Linux, Mac and windows machines.
You need to create a repository in codecommit and new users in IAM panel,
Create repositories:
Login into your aws.amazon.com, Click on AWS: Services -> codecommit -> Create new repository, then
Enter the repository name and description, click on "Create Repository".
You can get the two different git URL, ssh and https.
Create Users:
Now, Click on AWS: Services -> IAM, Choose -> Users -> Create New Users
Enter your user name and click on -> "Create"
For Linux System:
Open the terminal
1. Install a git package from the URL : http://git-scm.com/download/linux
or
Execute the command,
$ sudo apt-get install git
2 . Create a keygen
$ sudo ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user-name/.ssh/id_rsa): /home/your-user-name/.ssh/codecommit_rsa
Enter passphrase (empty for no passphrase): <Type a passphrase, and then press Enter>
Enter same passphrase again: <Type the passphrase again, and then press Enter>
.....
......
3. Run the following command to display the value of the public key file:
$ cat ~/.ssh/codecommit_rsa.pub
Login into AWS-codecommit server: https://console.aws.amazon.com/
Open IAM - > Users -> Username -> choose " Security Credentials" ->
Then, click on "Upload SSH public key"
Paste the contents of the SSH public key into the box and save it, you will get a SSH-key ID like ( APKAEIBAERJR2EXAMPLE )
4. Create a config file in /home/username/.ssh/
$ cd /home/username/.ssh/
$ vim config
Host git-codecommit.*.amazonaws.com
User APKAEIBAERJR2EXAMPLE
IdentityFile ~/.ssh/codecommit_rsa
Save and quit : wq!
5. change the permissions for the config file:
$ chmod 600 config
6. Run the following command to test your SSH configuration:
$ ssh git-codecommit.us-east-1.amazonaws.com
7. For information to help you troubleshoot problems, run the ssh command with the -v parameter:
$ ssh -v git-codecommit.us-east-1.amazonaws.com
8. git clone command. For example, to clone a repository named repos-name
$ git clone ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/repos-name repos-name
Now, clone all the files from the codecommit.
For Mac System:
Open the terminal
1. Install a git package from the URL : https://git-scm.com/download/mac
2 . Create a keygen
$ sudo ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/user-name/.ssh/id_rsa): /Users/your-user-name/.ssh/codecommit_rsa
Enter passphrase (empty for no passphrase): <Type a passphrase, and then press Enter>
Enter same passphrase again: <Type the passphrase again, and then press Enter>
.....
......
3. Run the following command to display the value of the public key file:
$ cat ~/.ssh/codecommit_rsa.pub
Login into AWS-codecommit server: https://console.aws.amazon.com/
Open IAM - > Users -> Username -> choose " Security Credentials" ->
Then, click on "Upload SSH public key"
Paste the contents of the SSH public key into the box and save it, you will get a SSH-key ID like ( APKAEIBAERJR2EXAMPLE )
4. Create a config file in /Users/username/.ssh/
$ cd /Users/username/.ssh/
$ vim config
Host git-codecommit.*.amazonaws.com
User APKAEIBAERJR2EXAMPLE
IdentityFile ~/.ssh/codecommit_rsa
Save and quit : wq!
5. change the permissions for the config file:
$ chmod 600 config
6. Run the following command to test your SSH configuration:
$ ssh git-codecommit.us-east-1.amazonaws.com
7. For information to help you troubleshoot problems, run the ssh command with the -vparameter:
$ ssh -v git-codecommit.us-east-1.amazonaws.com
8. git clone command. For example, to clone a repository named repos-name
$ git clone ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/repos-name repos-name
Now, clone all the files from the codecommit.
For Windows System :
Git Download and Install : https://git-scm.com/download/win
AWSCLI Download and install : https://aws.amazon.com/cli/
Set environment variable path for both git and awscli.
Login into AWS-codecommit server: https://console.aws.amazon.com/
Open IAM - > Users -> Create New User ->
Enter your user name and click on -> "Create" (Then, you will see the output like, "Your 1 User(s) have been created successfully.")
To view the login credential click on "Show User Security Credentials" (You will use that credential when you configure the codecommit)
It look like,
User Name : username
Access Key ID: AKIAJKSKLD393SKDOS
Secret Access Key: fZSKdi3#7(HgfcwH2fFS)a3s34sG(@d*KsN
Here's what you need to do in order to get started using it:
Open the command prompt :
1. Configure a credential helper for your profile. From the terminal or command prompt, run the below command
> aws configure --profile CodeCommitProfile
to set up a profile to use with AWS CodeCommit. Replace the red steps with your own information:
> AWS Access Key ID [None]: Type your AWS access key ID here, and then press Enter
> AWS Secret Access Key [None]: Type your AWS secret access key here, and then press Enter
> Default region name [None]: Type us-east-1 here, and then press Enter
> Default output format [None]: Type json here, and then press Enter
2. Configure Git to use the AWS CodeCommit credential helper. From the terminal or command prompt, run the following two commands:
> git config --global credential.helper "!aws --profile CodeCommitProfile codecommit credential-helper $@"
> git config --global credential.UseHttpPath true
3. Switch to a directory of your choice and clone the AWS CodeCommit repository to your local machine by running the following command:
Create a Directory the name of "Projects" under D: (D:/Projects)Partition,
On cmd prompt :
> d:
> cd Projects
> git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repos-name repos-name
Referred from : http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up.html
Comments (0)