Leave a comment

AWS Code Commit Steps For Linux Users

Login into your AWS Console :

https://console.aws.amazon.com

  • Go to Amazon Web Services ==> Amazon Web Services ==> and Click on Code Commit:

Create new repository:

  • On Dashboard of Code Commit Click on “Create new repository” they Type the “Repository name” and Description of Repository  in the Description field. Next Create Repository
  • Click on Repository and it will show 2 urls for cloning:

ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/Repository_Name

https://git-codecommit.us-east-1.amazonaws.com/v1/repos/Repository_Name

Create IAM User (Identity & Access Management):

  • Go to Amazon Web Services ==> Security & Identity and Click on
Identity & Access Management:
  • From the  “IAM Resources” Click on “Users” select the user if it is now create you can create it From “Create User
  •  Enter User Names: Selcet check box “Generate an access key for each user” and then Create user.
  •  Selcet User: Go to Permissions Tab ==>  Managed Policies ==> Attach Policy
  • From drop down list or in search bar select Policy  “AWSCodeCommitFullAccess”. and Click on Attach Policy:
  •  Next go to “Security Credentials” ==> SSH keys for AWS CodeCommit Section lick on “Upload SSH Public Key”
  • Create Key Follow the steps below for Linux Users:

cd $HOME/.ssh
ssh-keygen  // type the name for rsa key file and keep default all option
Copy  my_aws_codecommit_rsa.pub file code from $cat my_aws_codecommit_rsa.pub to IAM
User “Upload SSH Public Key” Section. and it looks like below

  iamupload
  • Next on your System create a file named “config” by typing cd $HOME/.ssh $ touch config

$ chmod 600 config
$ vi config

  • Enter the following value in Config file Host git-codecommit.*.amazonaws.com User [YOUR_SSH_KEY_ID_FROM_IAM] IdentityFile ~/.ssh/codecommit_rsa
    Verify by typing $ssh git-codecommit.us-east-1.amazonaws.com
    Successful Message: You have successfully authenticated over
    SSH. You can use Git to interact with AWS CodeCommit.

    • Now Git clone your Create Code Commit Repository to your desired path:

$ cd /var/www/html/ $ git clone ssh://git-codecommit.us-east-1.amazonaws.com/v1/ repos/Repository_Name Message: warning: You appear to have cloned an empty repository. Checking connectivity… done.
  • Put your code into the Repository and type $ git status # to check its status $ git add //your code files or directory
    git config --global user.name "Your Name"
    git config --global user.email you@example.com

$ git commit $ git push. Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 622 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: To ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/ MyGitRepository  * [new branch]      master -> master

 

Now Check your AWS Console Code Commit Repository it should be updated with latest Code you have committed:
Thanks !!

Leave a Reply

Your email address will not be published. Required fields are marked *