How to Setup Git on Amazon Web Services EC2 (Amazon Linux 2)

How to Setup Git on Amazon Web Services EC2 (Amazon Linux 2)

This guide is about How to Setup Git on Amazon Web Services EC2 (Amazon Linux 2). So read this free guide, How to Setup Git on Amazon Web Services EC2 (Amazon Linux 2) step by step. If you have query related to same article you may contact us.

How to Setup Git on Amazon Web Services EC2 (Amazon Linux 2) – Guide

Git is a freely available open source system for distributed version control. It is fast, scalable and system version control (tweaking log) files. As we know in the programming world, when writing hundreds of codes, frequent changes always occur. And these changes can be monitored and reversed with the help of the GIT; other files may be made available to others through “repositories” or changes may be obtained from others.

If necessary, settings from publicly accessible repositories (repos) can be imported into a “working copy” or you can make your own settings available to others. This gives the programmer better control over each version of the files, complete history and control of changes made. All this without any central server. It’s open source, so Git is also often used as a development platform, including for the Linux kernel.

Steps to Install Git on Amazon Ec2 Linux

. Connect to Ec2 instance

There are two easy ways to connect to the Ec2 instance running Linux, one is using the web console and the other via SSH from your local system’s command prompt or terminal.

. For Web Terminal

  • Just select your Instance and click on To connect button provided in the top menu.
  • After that, click again on the To connect button.
  • . Perform system update

    Before installing Git we will run the system update command on Amazon Ec2 Linux, this will update the existing packages and also update the system repository cache.

    sudo update yum

    . Install git on Amazon EC2 instance

    We don’t need to add any third-party repository to get Git on our Amazon Linux 2, just use the default YUM package manager and you’ll have it in your cloud VM through amzn2-core system repo. Here is the following command:

    sudo yum install git

    . Check Git Version

    Once the installation is complete, let’s check the version of Git available on our system.

    git version

    Let’s set up a local repository for Git

    Create a directory

    mkdir firstgit

    Access the created directory

    mygit cd /

    Now, initialize the local git repository

    git init

    You can see the content

    ls -a .git /

    To have git status, the command is:

    git status

    To list all git commands and subcommands

    git help -a

    Get help for a specific command

    git help

    Final note

    I hope you like the guide How to Setup Git on Amazon Web Services EC2 (Amazon Linux 2). In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.

    We will be happy to hear your thoughts

        Leave a reply

        Compsmag
        Logo