How to Download and Install Git Client for Windows Using PowerShell

Rohan Timalsina Feb 02, 2024
  1. Use the chocolatey Tool to Download and Install Git Using PowerShell
  2. Use the winget Command to Download and Install Git Using PowerShell
How to Download and Install Git Client for Windows Using PowerShell

Git is one of the most used version control systems for tracking changes in the source code. Developers can work on a single project with Git and track changes made in the source file.

There are multiple ways to install the Git client in Windows. You can directly download Git from the official website and install it on your computer.

Another method is to install Git from the command line. This tutorial will teach you to download and install Git in Windows using PowerShell.

Use the chocolatey Tool to Download and Install Git Using PowerShell

The chocolatey is a software management tool for Windows. First, you will need to install chocolatey on your computer.

Run PowerShell as an administrator and install the chocolatey package using 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://community.chocolatey.org/install.ps1'))

Output:

install chocolatey tool using powershell

After the chocolatey is installed, you can install Git with this command in PowerShell.

choco install -y git

Output:

use chocolatey tool to install git using powershell

The above output confirms that the Git is successfully installed on the computer. You can check the Git version by running the command below.

git --version

Output:

git version 2.36.1.windows.1

Use the winget Command to Download and Install Git Using PowerShell

winget is another popular command-line tool to find, install, update, and remove programs in Windows. The following command will install Git on the computer.

winget install --id Git.Git -e --source winget

Output:

use winget command to install git using powershell

Both the methods are easy to use and allow you to install Git automatically with a single command. We hope now you know how to install Git using PowerShell.

Rohan Timalsina avatar Rohan Timalsina avatar

Rohan is a learner, problem solver, and web developer. He loves to write and share his understanding.

LinkedIn Website

Related Article - PowerShell Git