How To Install Git on Windows 11

In this guide, you will learn to Install and Configure Git on Windows 11.

Git is the most commonly used version control system. It tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all to be merged into one source. 

So regardless of whether you write code that only you will see, or work as part of a team, Git will be helpful for you.

Git is software that runs locally. Your files and their history are stored on your computer. You can also use online hosts (such as GitHub or Bitbucket) to keep a copy of the files and their revision history. Having a centrally located place where you can upload your changes and download changes from others, enable you to collaborate more easily with other developers. Git can automatically merge the changes, so two people can even work on different parts of the same file and later merge those changes without losing each other’s work!

Steps To Install and Configure Git on Windows 11

To complete this guide, you must log in to your Windows Client and follow the steps below.

In this guide, you will learn to use the Chocolatey package manager to install Git.

Install Chocolatey on Windows 11

Chocolatey is a command-line package manager for the Windows operating system based on the NuGet package manager. Chocolatey manages its own package feed; however, you can set up your own local repository for the enterprise environment to control the package’s source for installation. If you are familiar with Linux or macOS environments, Chocolatey is similar to Apt and Homebrew, respectively.

To install Chocolatey, run your PowerShell as an administrator and run the following command:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

When you are finished, close the PowerShell and open it again.

Installing Git

At this point, from your PowerShell run the following command to set up Git on Windows 11:

choco install -y git

When your installation is completed, close the PowerShell to apply the changes.

To verify your Git installation, you can check its version from the PowerShell:

git --version
Example Output
git version 2.39.0.windows.1

Configure Git on Windows 11

Before you start to use Git in a project, you need to configure it to your username and email address.

To do this, from your PowerShell run the following commands with your desired username and email address:

# git config --global user.name your_username
# git config --global user.email [email protected]

To check the configuration settings for your repository, you can run the following command:

git config --global --list
Example Output
user.name=orca
[email protected]

Initialize a Repository with Git

If you have a project folder that is not currently using Git version control, open the folder, right-click on an empty place on the folder and choose the menu item “Git Bash Here“. It will open the Windows Git Bash terminal in your current working directory.

Git bash directory

From the terminal that opened for you, run the following command to initialize the new project:

git init
Output
$ git init
Initialized empty Git repository in C:/Users/Administrator/Downloads/Git Repo/.git/

The git init command is the command that allows us to create a local repository in Windows 11. The init command creates the .git subfolder (inside your current working directory) that contains all of the folders and configuration files of the local repository.

That’s it you are done.

Conclusion

At this point, you have learned to Install and Configure Git on Windows 11.

Hope you enjoy it.

You may be like these articles:

How To Install Dig on Windows 10

How To Check RAM Speed on Windows 11

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!