• Articles
  • Tutorials
  • Interview Questions

How to Install Git on Windows (2024)

How to Install Git on Windows (2024)

Git offers numerous advantages, such as streamlined code versioning, team collaboration, and detailed project change tracking. These benefits lead to smoother development workflows and increased productivity. So, let’s understand how to integrate the latest version of Git into your Windows development environment.

Points to be Covered

Tools and Features of Git for Windows

There are several key tools and features of Git for Windows:

  • Git BASH: Git for Windows provides a BASH emulation environment that allows users to run Git from the command line. This BASH emulation is designed to make *NIX (UNIX and Linux) users feel right at home. 
    It behaves just like the “git” command in UNIX and LINUX environments, which means that users familiar with those systems can use their existing knowledge and workflows when working with Git on Windows. Git BASH provides a powerful and flexible command-line interface for Git operations.
  • Git GUI: While some users prefer working with the command line, others prefer graphical user interfaces (GUIs). Git for Windows offers the Git GUI, which is a robust alternative to Git BASH. 
    The Git GUI provides a graphical version of nearly every Git command line function, making it accessible and user-friendly for those who may not be comfortable with the command line. It also includes comprehensive visual diff tools such as Meld, P4Merge, Kompare, etc, making it easy to visualize and manage changes in your codebase.
  • Shell Integration: Git for Windows seamlessly integrates with the Windows shell, allowing you to access Git BASH or the Git GUI directly from Windows Explorer. This means that you can right-click on a folder or file in Windows Explorer and choose to open it in either Git BASH or the Git GUI. This level of integration simplifies the process of working with Git in your preferred environment.
  • Git Credential Manager: Managing credentials and authentication when working with Git repositories hosted on platforms like GitHub or Azure Repos can be a hassle.
    Git Credential Manager, included with Git for Windows, provides a secure and convenient solution. It stores and manages your Git credentials securely, eliminating the need to enter your username and password repeatedly. It supports authentication with popular Git hosting services, ensuring a seamless and secure authentication process.

Get in touch with Intellipaat for comprehensive DevOps training and be a certified DevOps Engineer!

Prerequisites for Installing Git on Windows

There are several prerequisites you should keep in mind while trying to install Git on Windows. These prerequisites will help ensure a smooth installation and usage of the latest version of Git on your Windows system.

Here are the key prerequisites:

  • A Windows computer (64-bit).
  • An internet connection.
  • Sufficient disk space for the installation.

Clear the concepts of Git from this Git Tutorial for beginners!

Downloading and Installing Git on Windows

To download and install the latest (2.43.0) 64-bit version of Git for Windows, you need to follow several steps. Below, we will guide you through the following steps with the help of screenshots, which will make your installation process easy:

  • Click here to download the latest installer for Git on Windows. It will initiate the downloading process on your system.
  • After the file gets downloaded, you need to double-click on the file, and it will display the GNU General Public License page. Read and accept that by clicking the “Next” button.
Git Set Up
  • In the next step, you need to select the destination folder where Git should be installed. By default, it will select the destination on the C drive. So if you want to continue, click Next. And, if you want to change the location of your file, click on Browse.
Where should Git be installed?
  • Choose the installation components you want to include. By default, all options are selected, which is recommended for most users. Click “Next” to continue.
Select Components in Git
  • The next step is to select the start menu folder, where you will see the Git folder automatically created. If you want to select a different folder, click Browse, or else click  Next.
Select start menu folder in git
  • After that, you will have the option of choosing the default editor used by Git. By default, it will take Vim(Git’s default editor). Now, click on Next.
default editor used by git
  • After clicking on Next, you will get the page for adjusting the name of the initial branch in new repositories. You can click on any of the options according to your preference and click Next.
adjusting the name of initial branch in git
  • Now the question arises: How would you like to use Git from the command line? It is recommended to prefer Git from the command line and third-party software.
adjusting your PATH environment in git
  • Now you need to choose a secure shell program for Git to use. You can select bundled openSSH and click on Next.
choosing the SSH executable in git
  • Here, you need to choose the HTTPS transport backend. It is preferred to go with the OpenSSL library.
choosing HTTPS transport backend in git
  • Clicking on Next will display the page asking how Git treats lines ending in text files.
  • Prefer the option of checkout Windows-style, commit Unix-style line endings.
line ending conversion in git
  • In the setup process, you will be asked about which terminal emulator you want to use with your Git Bash.
  • Choose to use MinTTY, which is the default terminal of MSYS2.
Terminal emulator to chose with Git Bash
default behavior of git pull
  • Now you need to choose a credential helper, where you can select Git Credential Manager and click on Next.
credential helper in git
  • In the next setup process, you need to configure the feature of extra options, where you can enable file system caching.
configuring extra options in git
  • Now configure experimental options where you can enable experimental support for pseudo consoles and a built-in file system monitor.

This GIT Cheat Sheet by Intellipaat is very useful and handy for our learner’s. Check this out!

configuring experimental options in git
  • Finally, the installation process of Git on Windows will be completed in this step after clicking on Finish.
Completing the Git setup wizard
  • Below is how Git Bash will look after the successful launch of Git on Windows.
git version 2.43.0
  • Now click on the Windows tab and search for Git CMD to set up the user configuration process on the latest version of Git.

Ready to ace your Git interview? Explore essential Git Interview Questions and gear up to impress recruiters with your knowledge and expertise!

Setting up Git After Installation

After successfully installing Git on your system, it’s time to customize your Git environment to suit your preferences. These initial configurations are typically done only once on a specific computer and will persist across Git upgrades. You can modify these settings at any time by re-running the provided commands.

Git provides a tool called git config that allows you to manage configuration variables governing various aspects of Git’s behavior and appearance. These configuration variables can be stored in three different places:

  • [path]/etc/gitconfig file- This file contains settings that apply to every user on the system and all their repositories. To interact specifically with this file, you can use the –system option with git config. Keep in mind that since this is a system-wide configuration file, making changes to it may require administrative or superuser privileges.
  • ~/.gitconfig or ~/.config/git/config file- These files store user-specific configuration values. You can instruct Git to read and write to ~/.gitconfig using the –global option, and these settings will affect all the repositories you work with on your system.
  • config file in the Git directory (i.e., .git/config) of the currently used repository- This configuration is specific to the particular repository you are working in. By default, Git reads and writes to this file, so you don’t need to specify any special options. However, you must be located within a Git repository for this option to work correctly.

Each level of configuration overrides values from the previous level, meaning settings in .git/config will take precedence over those in [path]/etc/gitconfig.

On Windows systems, Git looks for the .gitconfig file in the $HOME directory, which is typically C:\Users\$USER for most users. It also searches for [path]/etc/gitconfig, but this path is relative to the MSys root, where you installed Git on your Windows system during the installation process. 

For Git versions 2.x and later on Windows, there is an additional system-level config file located at C:\Documents and Settings\All Users\Application Data\Git\config on Windows XP and C:\ProgramData\Git\config on Windows Vista and newer. Modifying this system-level config file requires using git config -f <file> with administrative privileges.

You can review all your configuration settings and their sources by running the following command:

$ git config --list --show-origin

Setting Username and Identity

One of the first tasks after installing Git on Windows is to configure your user name and email address. This information is crucial because it is associated with every Git commit you make and is permanently recorded in your commits.

$ git config --global user.name "Intellipaat2003"
$ git config --global user.email [email protected]
setting username and identity in git

Using the –global option ensures that Git uses these identity details for all your Git activities on that system. However, if you need to use different identity information for specific projects, you can omit the –global option and run the command within the context of that project.

Many GUI tools will assist you in setting these configurations when you first use them.

Verify Your Settings

To verify your configuration settings, you can use the following command:

$ git config --list
verify your settings in git

This command will display a list of all the Git configuration settings that Git has access to at that moment. It’s a helpful way to confirm that your identity and other settings have been correctly configured.

Course Schedule

Name Date Details
AWS Certification 22 Jun 2024(Sat-Sun) Weekend Batch
View Details
AWS Certification 29 Jun 2024(Sat-Sun) Weekend Batch
View Details
AWS Certification 06 Jul 2024(Sat-Sun) Weekend Batch
View Details

About the Author

Application Architect

Rupinder is a certified IT expert in AWS and Azure, working as a DevOps Architect and specializing in cloud and infrastructure. He designs and builds entire IT setups for important apps in banking, insurance, and finance.