How to Install and Use Git on Windows 11

Git is one of the most popular version control systems, allowing you to keep track of all the changes made to files so that, when required, you can easily revert to an earlier version. Git lets you have both a local repository and a remote one, encouraging collaboration by others and bringing all those changes to a single source. 

There are a few ways you can install Git on Windows 11. Here’s everything you need to know about it.

Prerequisites to install Git on Windows 11

Before we begin, there are a few prerequisites to installing Git on Windows. Here they are:

  • Administrator privileges for your Windows account
  • Access to a command-line tool (such as CMD or PowerShell)
  • Username and password for Git (optional)
  • Your favorite text editor
  • Ubuntu on WSL (if you’re installing on it)

Related: How to Create a Restore Point in Windows 11

How to install Git on Windows 11

Now, let’s take a look at how to install Git the traditional way. Here’s how to go about it:

Step 1: Download Git

The first step is to get the Git setup file. To do so, click on the following link:

Download: Git Official page

On the downloads page, click on Windows to get the latest setup file.

Step 2: Run Git setup

Now, navigate to the downloaded setup file and double-click to run the installer. Click Next.

Keep the default installation location, and click Next.

On the next screen, you’ll be able to select which components you want to install. Unless you need to change something specifically, we recommend keeping the options set to default. Then click Next.

Click Next again.

On the next screen, you’ll have to choose the default editor for Git. Click on the drop-down menu to do so.

Then select your text editor. We are going with Notepad++.

Click Next.

On the next screen, you’ll have the option to choose a different name for the initial branch in new repositories. The default name is ‘master’. Keep it that way unless you want a different one, and click Next.

The next step adds the PATH environment for Git when running commands from command-line applications (such as CMD and PowerShell). Keep it set to default, and click Next.

Now, choose the Secure Shell client program for Git to use. As the installer comes bundled with the OpenSSH, there are no changes required here (unless you want to use an external OpenSSH). Click Next.

When choosing server certificates, we recommend using the default OpenSSL library. Click Next.

This section lets you configure line-ending conversations. Leave it as set to default, then click Next.

Now choose your terminal emulator. Again, we’d recommend sticking with the default MinTTY. Click Next.

Keep the default behavior of the command git pull. As before, if you don’t want to change its behavior, the default option is recommended. Click Next.

Now, you have to choose a credential helper that will help get and save credentials. The Git Credential Manager core (default selection) is the most stable one of the lot, so just click Next.

There are a few extras to configure as well. The first option (selected by default) is to “Enable file system caching”. This is important for certain functions and also gives a significant performance boost. The other option is to “Enable symbolic links” which are similar to command-line shortcuts. Select it if you use them, or leave it be if you don’t. Then click Next.

The last few options you get are “support for pseudo consoles” and a “built-in file system monitor”. These are experimental features that are being actively developed. So, unless you want to try them out, we recommend leaving them unchecked. Then, finally, click on Install.

Once the installation is complete, click Finish.

Related: All the Windows 11 Shortcuts

Step 3: Check Git version

Once you’ve installed Git, it’s time to check if Git is installed properly and its version. To do this, launch the Git Bash from the Start menu.

Then type the following command and hit enter:

git --version

You should see the git version installed on your PC.

Step 4: Configure Git with username and email

To start using Git on Windows 11, you need to configure it by entering your credentials. Here is how you can do so:

Open Git Bash, then type the following to add your user name:

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

Make sure to replace “your user name” with your actual username. Then press Enter.

Now type the following command:

git config --global user.email "your email address"

Again, make sure to replace “your email address” with your actual email address associated with your Git account. Then press Enter.

Now, if you want to check the configuration, type the following:

git config --global --list

Then press Enter.

You will see your configuration details.

Note: The --global command tells Git to use the information you provided for all that you do on your system. If you use --local instead, the configuration will only apply to your current repository.  

Related: How to Change a Wallpaper on Windows 11

Install GitHub Desktop for Windows 11

If you’re looking to get a GUI-aided application to manage your Git repositories and have others collaborate on it, GitHub Desktop is your friend. Its installation is also a very simple process. 

Download: GitHub Desktop

Go to the above link and click on Download for Windows (64-bit)

Then run the downloaded setup. The setup won’t require any changes and install GitHub automatically. Upon launch, you have the option to sign in to GitHub.com. Or you can go ahead and Skip this step.

Type in your username and email. Then click Finish.

And that’s it! GitHub Desktop is now ready to use.

Related: How to Install PIP on Windows 11

Use Git with PowerShell

There’s a common misconception that Git only works well with Git Bash when in fact it works just as nicely on PowerShell too. But there’s a little addition that you have to make to PowerShell before that can be done.

Check for Execution Policy

First up, you need to have the PowerShell ExecutionPolicy set to “RemoteSigned”. So press Start, type powershell, and click on Run as administrator.

Now type the following command in PowerShell:

Get-ExecutionPolicy

Press Enter.

If you receive the “RemoteSigned” message, then it is already set.

If not, then type the following command:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force

Then press Enter.

Now you’re ready to install the git module in PowerShell. 

Add the Posh-git module

To add the Posh-git module, type the following command:

Install-Module posh-git -Scope CurrentUser -Force

Then press Enter.

Next, we’re going to import the module into PowerShell. To do this, type the following command:

Import-Module posh-git

Press Enter.

You may want to make sure that the module loads as default. For this, type the following command:

Add-PoshGitToProfile -AllHosts

Press Enter.

You are now ready to use PowerShell for your git experience whenever you’re in a directory with a git repository.  

Install Git on Ubuntu WSL

If you’ve installed Ubuntu on Windows Subsystem for Linux (WSL), you can also install Git on it. Here’s how to go about it.

Open the Ubuntu App.

Then type the following command:

sudo add-apt-repository ppa:git-core/ppa

Press Enter. 

Then enter your password and press Enter.

Press Enter to continue adding the git repository.

Now type the following command to update it.

sudo apt-get update

Press Enter.

Now type the following to install git:

sudo apt-get install git

Press Enter.

When asked to confirm, type Y and press Enter.

You have now installed Git on Ubuntu WSL.

Frequently Asked Questions (FAQs)

Installing git to manage application versions and collaborating with others can be a little tricky for beginners and it’s natural to have questions about it. Here we address a few commonly asked queries that users generally have when installing git on Windows 11.

Can I use git in cmd?

When you install the Git GUI, you also install Git Bash and Git CMD. The latter is a command-line tool that is exactly like the Windows console but better at all things related to Git.    

What is the difference between local and remote git repositories?

Git repos (short for repositories) come in two kinds – local and remote. In simplest terms, the local git repository is the one that you create and manage locally, that is, on your computer alone. Its features and functions are exactly like any other git repository. 

On the other hand, the purpose of a remote repository (such as GitHub) is to share your own codes and files with the world, allowing others to branch, merge, rebase, etc.  

Does installing GitHub install Git?

Yes, if you don’t already have git, GitHub will install git’s latest version as well. 

We hope you were able to easily install git on your Windows 11 PC. 

RELATED

Leave a Reply

Your email address will not be published. Required fields are marked *