Git operations in Codecommit

0 75
  1. Once your codecommit repo is created, lets clone it as local repo by using
    git clone <codecommit repo url>
    
    Example:
    git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo

    Codecommit repo url can be found here, select the repo created in Create A CodeCommit Repository lab than click on Clone URL > Clone HTTPS

  2. Once you cloned the repo do change directory inside it
    cd <codecommit-repo-name>
    
    Example:
    cd MyDemoRepo
  3. Now, lets create a file in current directory or our local repo
    vim string.c
    
    #paste following content and save it
    include <stdio.h>
    
    int my_strlen(char *s)
    {
       char *p = s;
    
       while (*p)
          ++p;
    
       return (p - s);
    }
    
    int main(void)
    {
       int i;
       char *s[] = 
       {
          "Git tutorials",
          "WebMagic Informatica"
       };
    
       for (i = 0; i < 2; ++i)
          
       printf("string lenght of %s = %d\n", s[i], my_strlen(s[i]));
    
       return 0;
    }
    
    #For saving the file
    Click "ESC" on your keyword and type wq! do "ENTER" on your keyboard
  4. Now lets add this file to local repo by:
    git add .
  5. Lets stage the changes in local repo by:
    git commit -m "Initial commit"
  6. Push the changes to Codecommit repo by:
    git push
  7. Verify the changes have pushed or not by visiting AWS console

Leave A Reply

Your email address will not be published.