DevOps Engineer Masters Program (19 Blogs) Become a Certified Professional
AWS Global Infrastructure

DevOps

Topics Covered
  • DevOps (92 Blogs)
  • Docker (9 Blogs)
  • DevOps Engineer Masters Program (18 Blogs)
  • Kubernetes (11 Blogs)
SEE MORE

Install Git – Git Installation On Windows And CentOS

Last updated on Sep 14,2024 58.2K Views

Reshma Ahmed
Reshma is a tech-savvy professional working as a Research Analyst at Edureka.... Reshma is a tech-savvy professional working as a Research Analyst at Edureka. She is a DevOps evangelist, a Cloud enthusiast, a Big Data Hadoop...
2 / 10 Blog from Git & GitHub

How do I Download and Install Git?

Let me guide you through the process to install Git in your system through this blog. In case you want to know more about Git don’t forget to checkout this blogGit is a key skill required for DevOps Certification Training and multiple job roles.

In this Install Git blog you will learn:

Before you move ahead, check out this video on GIT installation.

Git Installation Tutorial for Beginners | Git Installation On Linux | DevOps Tools | Edureka

 

So, without any further ado, let us begin by understanding how to install Git on a Windows system.

Install Git On Windows

Step 1:

To download the latest version of Git, click on the link below:

Download Git for Windows

Great! Your file is being downloaded.

Step 2:

After your download is complete, Run the .exe file in your system.

Windows Run Git - Install Git - Edureka

Step 3:

After you have pressed the Run button and agreed to the license, you will find a window prompt to select components to be installed.

Windows Select Components - Install Git - Edureka

After you have made selection of your desired components, click on Next>.

Step 4:

The next prompt window will let you choose the adjustment of your path environment. This is where you decide how do you want to use Git.

Windows Adjusting Path Environment - Install Git - Edureka

You can select any of the three options according to your needs. But for beginners, I recommend using Use Git From Git Bash Only

Step 5:

The next step is to choose features for your Git. You get three options and you can choose any of them, all of them or none of them as per your needs. Let me tell you what these features are:

Windows Configuring Extra Features - Install Git - Edureka

The first is the option to Enable file system caching.

Caching is enabled through Cache manager, which operates continuously while Windows is running. File data in the system file cache is written to the disk at intervals determined by the operating system, and the memory previously used by that file data is freed.

The second option is to enable Git Credential Manager.

The Git Credential Manager for Windows (GCM) is a credential helper for Git. It securely stores your credentials in the Windows CM so that you only need to enter them once for each remote repository you access. All future Git commands will reuse the existing credentials.

The third option is to Enable symbolic links.

Symbolic links or symlinks are nothing but advanced shortcuts. You can create symbolic links for each individual file or folder, and these will appear like they are stored in the folder with symbolic link.

I have selected the first two features only.

Step 6:

Choose your terminal.

Windows Configuring Terminal Emulator - Install Git - Edureka

You can choose one from the options.

The default terminal of MYSYS2 which is a collection of GNU utilities like bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present.

Or you can choose the window’s default console window (cmd.exe).

Step 7:

Now you have got all you need. Select Launch Git Bash and click on Finish.

Windows Finishing Git Installation - Install Git - Edureka

This will launch Git Bash on your screen which looks like the snapshot below:

Git Bash Terminal - Install Git - Edureka

Step 8:

Let us proceed with configuring Git with your username and email. In order to do that, type the following commands in your Git Bash:

git config - - global user.name "<your name>"

git config - - global user.email "<your email>"

Git Windows Configuration - Install Git - Edureka

It is important to configure your Git because any commits that you make are associated with your configuration details.

If you want to view all your configuration details, use the command below:

git config - - list

Windows Git Configuration List - Install Git - Edureka

This is how you install and setup GIT on Windows.

   

Install Git on CentOS

Step 1:
First we need to install the software that Git depends on. These dependencies are all available in default CentOS repository.

Use the command:

sudo yum groupinstall "Development Tools"

Centos Git Installation Step 1 - Install Git - Edureka

It will ask for your confirmation to download the tools.

Centos Git Installation Step 2 - Install Git - Edureka

Press Y for Yes.

The “Development tools” which is a yum group, is a predefined bundle of software that can be installed at once, instead of having to install each application separately. The Development tools will allow you to build and compile software from source code.

Now use the command:

sudo yum install gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel

Centos Git Installation Step 3 - Install Git - Edureka

Enter your password. It will ask for your confirmation to download the package.

Centos Git Installation Step 4 - Install Git - Edureka

Press y.

Now we are ready with the prerequisites. Lets proceed towards Git installation.

Step 2:

Now we are going to use wget command to download a specific version of Git.

Centos Git Installation Step 5 - Install Git - Edureka

 But first we need to copy the link of the version that we want to install. For that go to this website.

You will find the following webpage:

Centos Git Installation Step 6 - Install Git - Edureka

I am downloading git-2.7.2.tar.gz version of Git.

Now use the wget command with the link of the Git version you have chosen to install. Use the command below:

wget https://github.com/git/git/archive/v2.7.2.tar.gz -O git.tar.gz

Centos Git Installation Step 7 - Install Git - Edureka

This downloaded file will be available in my directory.

Step 3:

Once the download is complete we will extract the file from the downloaded Git Tar file. For that we will use Tar command.

tar -zxf git.tar.gz

Centos Git Installation Step 9 - Install Git - Edureka

Lets see the extracted folder.

Centos Git Installation Step 10 - Install Git - Edureka

There it is! :-)

Step 4:

Now lets change the directory to Git.

Use the command cd git

Centos Git Installation Step 11 - Install Git - Edureka

Step 5:

We are in the source folder we can begin the source build process. For that first type in the command:

make configure

Centos Git Installation Step 12 - Install Git - Edureka

Now use the following command:

./configure --prefix=/usr/local

Centos Git Installation Step 13 - Install Git - Edureka

The configure script is responsible for getting ready to build the software on your specific system. It makes sure all of the dependencies for the rest of the build and install process are available once configure has done its job, we can invoke make to build the software.

Step 6:

Now that the software is built and ready to run, the files can be copied to their final destinations. Use the command below:

sudo make install

Centos Git Installation Step 14 - Install Git - Edureka

The make install command will copy the built program, and its libraries and documentation, to the correct locations.

Step 7:

Now to check the version of Git installed  we will use the command:

git --version

Centos Git Installation Step 15 - Install Git - Edureka

Step 8:

Before we go ahead you need to submit some information about yourself so that commit messages will be generated with the correct information attached.
We need to provide Name and Email address that we would like to embed into our commits, to do that we will use following commands:

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

git config --global user.email "you@example.com"

Centos Git Installation Step 16 - Install Git - Edureka

To confirm that these configurations are added successfully we will use the command:

  git config --list 

Centos Git Installation Step 17 - Install Git - Edureka

Step 9:

Now we need to generate a SSH key.
SSH is a secure protocol used as the primary means of connecting to Linux servers remotely. Now to generate a new SSH key we will use:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Centos Git Installation Step 18 - Install Git - Edureka

It will ask you to enter the file name where you want to save the key. If you want it saved in your default directory press ‘Enter’. Enter blank passphrase if you want to and then enter the same again.

There is a program called ssh-agent that runs the duration of a local login session. It stores unencrypted keys in memory, and communicates with SSH clients using a Unix domain socket. So to ensure that SSH agent is enabled we will use this command below:

eval "$(ssh-agent -s)"

Centos Git Installation Step 19 - Install Git - Edureka

To add SSH key to the SSH agent we will use

ssh-add ~/.ssh/id_rsa

Centos Git Installation Step 20 - Install Git - Edureka

To add SSH key to our GitHub account we will use:

cat ~/.ssh/id_rsa.pub

Centos Git Installation Step 21 - Install Git - Edureka

The gibberish you see on screen is actually the SSH key. ;-)

Finally we need to copy the SSH key and then we need to go to the GitHub account and click on settings.

(P.S. If you don’t have a GitHub repository and want to learn how to create it , skip here )

Centos Git Installation Step 22 - Install Git - Edureka

and then go to SSH and GPG keys option on the left.

Centos Git Installation Step 23 - Install Git - Edureka

 

We will now click on New SSH key and add title to it  and then paste the copied key in the space provided. Now we will click on add SSH key

Centos Git Installation Step 24 - Install Git - Edureka

Now use the below command to test the SSH key:

ssh -T git@github.com

Centos Git Installation Step 29 - Install Git - Edureka

Now we can see in the snapshot below, that the colour of the key is green. It means we have successfully tested the key.

Centos Git Installation Step 25 - Install Git - Edureka

This is how you install Git and connect to your central repository on Git.

Create GitHub Repositories

You have learnt to install Git in your system and now its time to make repositories on GitHub that will act as your remote repository.

Step 1:

Go to “www.github.com” and like a piece of cake, all you need to do to Sign Up is fill up the following form and click on Sign Up.

Step 2:

Choose if you want your repositories to be private or public.

GitHub First Step - Install Git - Edureka

After choosing your plan, click on Continue

Step 3:

Confirm your email and then click on Start a project.

GitHub Start A Project - Install Git - Edureka

Step 4:

Name your repository and click on Create repository.

GitHub Create Repository - Install Git - Edureka

Your repository will look like this snapshot below:

GitHub Repository - Install Git - Edureka

Now, you are all ready to commit, pull, push and perform all other operations using Git. If you want to learn how to perform these operations and more, please checkout my Git Tutorial blog.

Do I need to install git to use GitHub?

You need to have Git installed if you want to work on your project on your local computer. GitHub will not work on your local computer if you don’t have Git installed. So, install Git for Windows, Mac, or Linux as needed.

How do I know if git is installed or not?

To check if git is installed or not, open the command prompt and execute the command git --version. If this returns a valid version number that means you have git installed in your system.

If you found this “Install Git – Git Installation On Windows And CentOS” relevant, check out the DevOps Certification Course  by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. The Edureka DevOps Certification Training course helps learners gain expertise in various DevOps processes and tools such as Puppet, Jenkins, Ansible, Nagios and Git for automating multiple steps in SDLC.

Upcoming Batches For DevOps Engineer Masters Program
Course NameDateDetails
DevOps Engineer Masters Program

Class Starts on 23rd November,2024

23rd November

SAT&SUN (Weekend Batch)
View Details
Comments
4 Comments
  • Great post: Just a small suggestion above. In step 8 of the windows install I think the bash commands should be changed:

    from
    git config – – global user.name “
    git config – – global user.email “

    to
    git config –global user.name “
    git config –global user.email “

    • Hey Jorge, thanks for checking out our blog and for pointing out the mistake. We have corrected it in the blog. :) We are installing the 2.7.2 version itself. Cheers!

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

Install Git – Git Installation On Windows And CentOS

edureka.co