Install and Configure git in Linux and Ubuntu EC2 Instance

Srini
1 min readSep 9, 2020

Installation of GIT on RHEL

Install Server Updates

yum update -y

Install git package

yum install git -y

Verify git Package

which git

Check Version of git Package

git — version

Set Username Configuration

git config — global user.name “Ram”

Set Email Configuration

git config — global user.email “username@gmail.com”

Verify Username and Email Configurations

git config — list

Set the Date

date +%T -s”21:43:00"

Verify Date

date

Installation of GIT on UBUNTU 18.04

Step 1 — Update Default Packages

Logged into your Ubuntu 18.04 server as a sudo non-root user, first update your default packages.

sudo apt update

Step 2 — Install Git

sudo apt install git

Step 3 — Confirm Successful Installation

You can confirm that you have installed Git correctly by running this command and receiving output similar to the following:

git --version

Outputgit version 2.17.1

Step 4 — Set Up Git

Now that you have Git installed and to prevent warnings, you should configure it with your information.

git config --global user.name "Your Name"

git config --global user.email "youremail@domain.com"

If you need to edit this file, you can use a text editor such as nano:

vi ~/.gitconfig

~/.gitconfig contents

[user]
name = Your Name
email = youremail@domain.com

--

--