How to install Git in CentOS?

How to install git in CentOS 6 or CentOS 7?

Update the packages:

Install Git:

Check if Git installation was successful:

Configure and use git:

How to install git in CentOS 8?

Update the packages:

Install Git:

Check if Git installation was successful:

Configure and use git: