How to Install and Use Git on Windows

January 8, 2020

Introduction

Git is a widely used open-source software tracking application used to track projects across different teams and revision levels.

This guide will show you how to install Git on Windows.

tutorial on Installing Git Windows

Prerequisites

  • Administrator privileges
  • Access to a command-line
  • Your favorite coding text editor
  • Username and password for the Github website (optional)

Steps For Installing Git for Windows

Installing Git prompts you to select a text editor. If you don’t have one, we strongly advise you to install prior to installing Git. Our roundup of the best text editors for coding may help you decide.

Note: If you are new to Git, refer to our post How Does Git Work to learn more about Git workflow and Git functions.

Download Git for Windows

1. Browse to the official Git website: https://git-scm.com/downloads
2. Click the download link for Windows and allow the download to complete.

Windows version on Git page to download

Extract and Launch Git Installer

3. Browse to the download location (or use the download shortcut in your browser). Double-click the file to extract and launch the installer.

 example Location where the Git file has been downloaded

4. Allow the app to make changes to your device by clicking Yes on the User Account Control dialog that opens.

Initiate the Git installation process by selecting Yes

5. Review the GNU General Public License, and when you’re ready to install, click Next.

Accept Git Terms of Use

6. The installer will ask you for an installation location. Leave the default, unless you have reason to change it, and click Next.

Select the location for the Git installation on windows

7. A component selection screen will appear. Leave the defaults unless you have a specific need to change them and click Next.

This screen allows you to select custom Git componenets to install.

8. The installer will offer to create a start menu folder. Simply click Next.

Create shortcuts in Windows Start Menu

9. Select a text editor you’d like to use with Git. Use the drop-down menu to select Notepad++ (or whichever text editor you prefer) and click Next.

choosing a text editor durring Git installation

10. The next step allows you to choose a different name for your initial branch. The default is 'master.' Unless you're working in a team that requires a different name, leave the default option and click Next.

Choose a name for your initial git branch.

11. This installation step allows you to change the PATH environment. The PATH is the default set of directories included when you run a command from the command line. Leave this on the middle (recommended) selection and click Next.

Adjust Git path enviorment

Server Certificates, Line Endings and Terminal Emulators

12. The installer now asks which SSH client you want Git to use. Git already comes with its own SSH client, so if you don't need a specific one, leave the default option and click Next.

Choose which SSH client to use in git.

Note: Check out our comparison of SSH and HTTPS for Git and which one you should use.

13. The next option relates to server certificates. Most users should use the default. If you’re working in an Active Directory environment, you may need to switch to Windows Store certificates. Click Next.

server sertificate for Git to use selcted

14. The next selection converts line endings. It is recommended that you leave the default selection. This relates to the way data is formatted and changing this option may cause problems. Click Next.

Select line end conversions

15. Choose the terminal emulator you want to use. The default MinTTY is recommended, for its features. Click Next.

Select MinTTY as default terminal emulator

16. The installer now asks what the git pull command should do. The default option is recommended unless you specifically need to change its behavior. Click Next to continue with the installation.

Choose what the git pull command does in git.

17. Next you should choose which credential helper to use. Git uses credential helpers to fetch or save credentials. Leave the default option as it is the most stable one, and click Next.

Choose a git credential helper.

Additional Customization Options

18. The default options are recommended, however this step allows you to decide which extra option you would like to enable. If you use symbolic links, which are like shortcuts for the command line, tick the box. Click Next.

Choose extra options during git installation.

19. Depending on the version of Git you’re installing, it may offer to install experimental features. At the time this article was written, the options to include support for pseudo controls and a built-in file system monitor were offered. Unless you are feeling adventurous, leave them unchecked and click Install.

Configure experimental git features.

Complete Git Installation Process

20. Once the installation is complete, tick the boxes to view the Release Notes or Launch Git Bash, then click Finish.

Git installation on Windows is done

Note: Learn the differences between CLI and GUI.

How to Launch Git in Windows

Git has two modes of use – a bash scripting shell (or command line) and a graphical user interface (GUI).

Launch Git Bash Shell

To launch Git Bash open the Windows Start menu, type git bash and press Enter (or click the application icon).

how to start Git bash from Windows

Launch Git GUI

To launch Git GUI open the Windows Start menu, type git gui and press Enter (or click the application icon).

initial Git GUI screen

Connecting to a Remote Repository

You need a GitHub username and password for this next step.

Create a Test Directory

Open a Windows PowerShell interface by pressing Windows Key + x, and then i once the menu appears.

Create a new test directory (folder) by entering the following:

mkdir git_test

An example of the PowerShell output.

Example of creating a test directory in Windows PowerShell.

Change your location to the newly created directory:

cd git_test

Note: If you already have a GitHub repository, use the name of that project instead of git_test.

Configure GitHub Credentials

Configure your local Git installation to use your GitHub credentials by entering the following:

git config --global user.name "github_username"
git config --global user.email "email_address"

Note: Replace github_username and email_address with your GitHub credentials.

Clone a GitHub Repository

Go to your repository on GitHub. In the top right above the list of files, open the Clone or download drop-down menu. Copy the URL for cloning over HTTPS.

Cloning a GitHub repository over HTTPS

Switch to your PowerShell window, and enter the following:

git clone repository_url

Important: In the example above, the command will clone the repository over HTTPS. Another option is cloning with SSH URLs. For that option to work, you must generate an SSH key pair on your Windows workstation and assign the public key to your GitHub account.

List Remote Repositories

Your working directory should now have a copy of the repository from GitHub. It should contain a directory with the name of the project. Change to the directory:

cd git_project

Note: Replace git_project with the actual name of the repository you downloaded. If it’s not working, you can list the contents of the current directory with the ls command. This is helpful if you don’t know the exact name or need to check your spelling.

Once you’re in the sub-directory, list the remote repositories:

git remote -v

Pushing Local Files to the Remote Repository

Once you’ve done some work on the project, you may want to submit those changes to the remote project on GitHub.

1. For example, create a new text file by entering the following into your PowerShell window:

new-item text.txt

2. Confirmation that the new file is created.

Create new text file in Windows PowerShell.

3. Now check the status of your new Git branch and untracked files:

git status

4. Add your new file to the local project:

git add text.txt

5. Run git status again to make sure the text.txt file has been added. Next, commit the changes to the local project:

git commit -m "Sample 1"

6. Finally, push the changes to the remote GitHub repository:

git push

You may need to enter your username and password for GitHub.

Note: You can remove a remote repository if the need for it no longer exists. To learn how, visit our guide How to Remove a Git Remote.

Conclusion

You now have a working installation of Git on your Windows system. After installing Git on your Windows, you might find helpful how to update Git. Use Git’s features to coordinate work among programmers on a project.

For Linux and MacOS installation guides, check out our articles on installing Git on UbuntuCentOS and MacOS.

Was this article helpful?
YesNo
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
How To Rename a Local and Remote Git Branch
January 6, 2020

Git is a version control system that helps you control the stages of...
Read more
How to Create a New Branch in Git
January 9, 2024

This article outlines the basic commands needed to create a Git branch. A Git...
Read more
How To Install Git on Ubuntu 18.04 / 20.04
December 1, 2022

Git is a widely-used software package in Linux. Its main purpose is to...
Read more
How to Install Git on CentOS 7 With Yum or Latest Repository
March 15, 2019

In this tutorial, learn how to install Git on CentOS 7. Git is a distributed...
Read more