Recently, I was trying to set up Git on my new Windows laptop, which I did using PowerShell. In this tutorial, I will explain how to install Git on Windows using PowerShell. Git is a powerful version control system that allows developers to track changes in their codebase and collaborate with others efficiently. You will know how to install Git and start using it easily in your projects.
Install Git on Windows Using PowerShell
Note: You need administrative access to the computer to install Git.
Step 1: Download Git for Windows
The first step is to download the latest version of Git for Windows. Visit the official Git website and click on the download link for the 64-bit or 32-bit version, depending on your system architecture. Once the file is downloaded, proceed to the next step.

Step 2: Install Git Using the Executable
Locate the downloaded Git installer executable (e.g., Git-2.34.1-64-bit.exe) and double-click on it to start the installation process. You will be greeted with the Git Setup wizard.
Click “Next” to proceed through the installation steps. You can leave the default options selected unless you have specific requirements. When prompted to choose the default editor for Git, select your preferred text editor (e.g., Notepad++, Visual Studio Code) from the dropdown menu.
On the “Adjusting your PATH environment” screen, choose “Git from the command line and also from 3rd-party software.” This option ensures that Git is available from both PowerShell and the command prompt.

Continue clicking “Next” until you reach the “Configuring the line ending conversions” screen. Here, select “Checkout Windows-style, commit Unix-style line endings.” This setting helps maintain consistency across different operating systems.

Finally, click “Install” to begin the installation process.

Once the installation is complete, you can launch Git Bash or proceed to the next step to configure Git in PowerShell.

Check out Disable Windows Defender Using PowerShell
Step 3: Configure Git in PowerShell
Now that Git is installed, let’s configure it in PowerShell. Open PowerShell by searching for it in the Start menu and clicking on “Windows PowerShell.”
First, check if Git is properly installed by running the following command:
git --versionIf Git is installed correctly, it will display the version number, like “git version 2.47.1.windows.2”.
You can see in the screenshot below:

Next, configure your user name and email address using the following commands, replacing “John Doe” and “johndoe@example.com” with your own information:
git config --global user.name "John Doe"
git config --global user.email "johndoe@example.com"These details will be associated with your commits, making it easier to identify who made specific changes in the codebase.
Read Monitor and Manage CPU Usage using Windows PowerShell
Step 4: Enhance PowerShell with posh-git (Optional)
To further improve your Git experience in PowerShell, you can install the posh-git module. Posh-git provides helpful Git status information directly in your PowerShell prompt.
To install posh-git, run the following command in PowerShell:
Install-Module posh-git -Scope CurrentUser -ForceOnce installed, you need to import the module every time PowerShell starts. To automate this process, execute the following command:
Add-PoshGitToProfileThis command adds the import statement to your PowerShell profile script, ensuring posh-git is loaded automatically whenever you open PowerShell.
Read Install Snipping Tool in Windows 11 Using PowerShell
Using Git in PowerShell
With Git installed and configured, you’re ready to start using it in your projects. Here are a few basic commands to get you started:
- Clone a repository:
git clone https://github.com/username/repository.git- Navigate to the cloned repository:
cd repository- Check the status of your repository:
git status- Stage changes for commit:
git add .- Commit the staged changes with a message:
git commit -m "Add new feature"- Push the changes to the remote repository:
git push origin mainThese are just a few examples of the many Git commands available. As you become more familiar with Git, you’ll discover additional commands that suit your development process.
Conclusion
In this tutorial, we learned how to install Git on Windows using PowerShell. We walked through the process of downloading and installing Git, configuring it in PowerShell, and optionally enhancing the experience with posh-git. With Git set up, you can now efficiently manage your codebase, collaborate with others, and take advantage of version control in your projects.
You may also like:
- Get an IP Address Using PowerShell in Windows
- How to Set Service to Automatic Using PowerShell?
- Change Windows 11 Desktop Background Color with PowerShell
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.