Essential Guide

Browse Sections

How to install Git on Windows

How to install Git on Windows 10

There are plenty of things to love about Git. One of them is its simple and straightforward installation, especially on Windows.

There are no prerequisites to install Git, except a moderately up-to-date operating system and 325MB of free disk space. In this example, we’ll install the latest version of Git on Windows 10, which is now over eight years old.

To perform a quick, trouble-free installation of Git on Windows, simply download the installation file from git-scm.com/downloads and run it.

How to customize your Git install

There are numerous possible options to configure when you install Git on Windows, but if you accept all of the defaults you’ll stay out of trouble.

However, if you want to customize your installation of Git on Windows for maximum utility, make these two changes:

  • Use main as the default branch name instead of master.
  • Choose Notepad++ or even Windows Notepad as the default editor.

There has been a move away from use of the term master in the world of software development. The default branch created in a new GitHub repository is now main, not master. Use main as Git’s default branch name and you’ll be in line with industry standards.

Furthermore, the default text editor for Git commits and Git merges is VIM, which can be intimidating and difficult to use. Choose a text editor you are more familiar to smooth the Git learning path over time.

Steps to install Git on Windows

Here are the per-screen steps to follow when you install Git on Windows:

1. Download the executable Git file from git-scm.com/downloads.
2. Run the installation file with Administrator rights.
3. Choose an appropriate installation location such as C:\_tools\git.
4. Install the default components, including Git GUI Here and Git Bash Here.
5. Choose your preferred Git default editor. We recommend Notepad++.
6. Add Git to the Windows PATH.
7. Accept the default line ending conversion for Unix and Windows compatibility.
8. Chose the extra option to enable system caching.
9. Click Finish to complete the install.
10. Choose to open a Git Bash shell and start using Git!

Test the Windows Git install

To test the veracity of your Windows Git install, issue the five basic Git commands every developer should know. Those basic Git commands are as follows:

  1. init
  2. add
  3. config
  4. status
  5. commit

Before you run Git init, first create a new folder named repos off the C:\ drive:

windows@install-git MINGW64 /c/repos
$ git init
Initialized empty Git repository in C:/repos/.git/

In the newly created folder, add a file named windows-git-install.txt:

windows@install-git MINGW64 /c/repos
$ touch windows-git-install.txt

Then add the file to the Git index:

windows@install-git MINGW64 /c/repos
$ git add .

Configure the Git user’s email address and username:

windows@install-git MINGW64 /c/repos
$ git config --global user.name "Cameron McKenzie"
windows@install-git MINGW64 /c/repos
$ git config --global user.email "[email protected]"

Commit the new file to the new Git repository:

windows@install-git MINGW64 /c/repos
$ git commit -m "New Windows git install commit"
[master (root-commit) 5b8f1f4] New Windows git install commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 windows-git-install.txt

And finally, check the status of the newly installed Git repo:

windows@install-git MINGW64 /c/repos
$ git status
On branch master
nothing to commit, working tree clean

Windows Git test

How to verify a Windows Git installation.

This concludes the task to install Git on Windows 10, and ensure the DVCS tool is properly configured to manage source code and interact with SaaS-based tools such as GitHub, GitLab and BitBucket.

Basic Git commands