---
title: "Getting Started with Git Bash Commands on Windows"
description: "Start your journey with Git and learn about Git Bash commands on Windows and run some basic commands on Git Bash terminal on Windows in this tutorial!"
canonical: "https://adamtheautomator.com/git-bash-commands/"
---

# Getting Started with Git Bash Commands on Windows

> Start your journey with Git and learn about Git Bash commands on Windows and run some basic commands on Git Bash terminal on Windows in this tutorial!

Source: https://adamtheautomator.com/git-bash-commands/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Getting Started with Git Bash Commands on Windows](https://adamtheautomator.com/wp-content/uploads/2021/08/How-to-Get-Started-with-Git-Bash-on-Windows.jpg)

# Getting Started with Git Bash Commands on Windows

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)25 October 20237 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Git](/tag/git/)[Windows](/tag/windows/)

Table of Contents

*   [Prerequisites for Git Bash](#prerequisites-for-git-bash)
*   [Understanding Git Bash](#understanding-git-bash)
*   [Procuring and Setting Up Git Bash](#procuring-and-setting-up-git-bash)
*   [Utilizing Git Bash Commands in Various Terminals](#running-git-bash-commands-in-different-terminals)
*   [Using Linux Commands with Git Bash on Windows](#running-linux-commands-in-git-bash)
*   [Wrapping Up Git Bash Commands on Windows](#conclusion)

Have you ever wondered how you can access Linux utilities directly on your Windows OS? Well, Git Bash offers a solution. Whether you desire a separate terminal to run Git or want to familiarize yourself with Git Bash commands ([Bourne Again Shell](https://en.wikipedia.org/wiki/Bash_\(Unix_shell\)l)), this guide has you covered.

Not a reader? Watch this related video tutorial!

**_Not seeing the video? Make sure your ad blocker is disabled._**

In this segment, you’ll delve deeper into Git Bash, its installation process on Windows, and how to execute some fundamental Git Bash commands on a terminal.

## Prerequisites for Git Bash

The demonstrations in this tutorial are tailored for a Windows 11 PC version 22H2, but prior versions of Windows will suffice for Git Bash.

## Understanding Git Bash

Before delving into Git Bash, let’s clarify what [Git](https://en.wikipedia.org/wiki/Git) is. Git is a version control system designed to manage software development changes. Operating systems like macOS and Linux come with a native command-line terminal, making it straightforward to run Git and Linux commands. However, Windows presents a challenge with its non-Unix terminal.

So, how do you bridge this gap on Windows? The answer is Git Bash. Git Bash commands provide an emulation layer, allowing Git to execute Linux commands seamlessly on Windows systems. An emulator ensures one system mimics the behavior of another.

## Procuring and Setting Up Git Bash

Armed with a bit of knowledge about Git Bash, let’s discuss its acquisition and installation process. There are three distinguished methods to download the Git software for your Windows OS, detailed below.

*   By visiting [Git’s official website](https://git-scm.com/download/win)
*   Through a dedicated project on GitHub known as [Git for Windows.](https://gitforwindows.org/)
*   Utilizing a software package manager such as [Chocolatey](https://chocolatey.org/)

Feel free to acquire Git Bash using any of the above methods. However, this guide places emphasis on the official website’s method.

![Git Bash official website screenshot](https://adamtheautomator.com/wp-content/uploads/2023/05/image-426-1024x775.png)

Git Bash official website for downloading the application.

![Choosing Git Bash version screenshot](https://adamtheautomator.com/wp-content/uploads/2023/05/image-427-1024x720.png)

Selecting the appropriate Git Bash version for your system.

Once you’ve downloaded Git Bash, it’s time to install it on your Windows PC. Modern systems even offer the capability for an unattended Git Bash installation via WinGet.

![Git Bash installation screenshot](https://adamtheautomator.com/wp-content/uploads/2023/05/image-449.png)

Git Bash installation screenshot

1\. Start the Git Bash installer you downloaded. Click **Next** repeatedly until you reach the **Select Components** screen.

2\. Here, check the boxes for any additional components you wish to include in the Git Bash installation. For now, let’s stick with the default selections shown below. Then, click **Next**.

![Selecting Git Bash components screenshot](https://adamtheautomator.com/wp-content/uploads/2023/05/image-429.png)

Picking the right components for Git Bash.

3\. Retain the default setting for the start menu shortcut creation and click **Next**.

![Git Bash start menu folder selection screenshot](https://adamtheautomator.com/wp-content/uploads/2023/05/image-430.png)

Picking the right start menu folder for Git Bash.

4\. From the drop-down list, select **Use Notepad as Git’s default editor** as the primary editor for Git Bash. This will ensure Git Bash files, like _[~./gitconfig](https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-config)_, open in Notepad by default.

![Selecting Git Bash's default editor screenshot](https://adamtheautomator.com/wp-content/uploads/2023/05/image-431.png)

Choosing the default editor for Git Bash.

5\. Opt for the **Override the default branch name for new repositories** setting, specifying the default branch name (**main**) Git Bash will utilize. Whenever you initialize a Git Bash repository, this will be the default branch name.

The default branch name was formerly “master” for Git repositories. However, due to its negative connotations, the term “master” became controversial. Hence, platforms like GitHub followed the [Software Freedom Conservancy’s](https://sfconservancy.org/news/2020/jun/23/gitbranchname/) recommendation, allowing users to customize the default branch name during Git repository initialization.

![Choosing Git Bash default branch name screenshot](https://adamtheautomator.com/wp-content/uploads/2023/05/image-432.png)

Selecting the default branch name in Git Bash.

6\. Lastly, pick the **Git from the command line and also from 3rd-party software** option. This ensures Git Bash commands can be executed from various interfaces, be it the Command Prompt, PowerShell, other 3rd-party software tools, or the Git Bash console itself.

![Git Bash console selection](https://adamtheautomator.com/wp-content/uploads/2023/05/image-433.png)

Choosing a Console for Running Git Bash Commands

7\. For secure connections, opt for the **Use the [OpenSSL](https://en.wikipedia.org/wiki/OpenSSL) library** setting, allowing Git Bash to validate certificates through OpenSSL. Then, click **Next**. OpenSSL is renowned for its robust cryptographic library that encapsulates an open-source SSL and TLS protocol implementation.

If you’re employing Git Bash within an enterprise environment with managed certificates, it’s advisable to pick the **User the native Windows Secure Channel library** option.

![Git Bash SSL/TLS library selection](https://adamtheautomator.com/wp-content/uploads/2023/05/image-434.png)

Picking the SSL/TLS library for secure Git Bash HTTPS connections

8\. Stick with the **Checkout Windows-style, commit Unix-style line endings** default option and proceed by clicking **Next**.

Configuring for “Windows-style” line endings means when you execute a Git Bash command and press return, Git Bash embeds a covert character known as [line ending](https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings#about-line-endings). Bear in mind that when multiple contributors make alterations from varied operating systems, this could cause Git Bash to yield unforeseen results.

![Git Bash line endings configuration](https://adamtheautomator.com/wp-content/uploads/2023/05/image-435.png)

Selecting the Git Bash line endings preference

9\. As for the terminal emulator for executing Git Bash commands, choose the **Use Mintty (the default terminal of MSYS2)** setting and hit **Next**. Mintty is the prime terminal for [MSYS2](https://www.msys2.org/wiki/MSYS2-introduction/), a suite of tools offering a Unix-like ambiance on Windows.

![Git Bash terminal emulator selection](https://adamtheautomator.com/wp-content/uploads/2023/05/image-436.png)

Selecting Git Bash’s default terminal emulator

10\. For the behavior of the [`git pull`](https://github.com/git-guides/git-pull) command in Git Bash, opt for the **Default (fast-forward or merge)** setting. Remember, the `git pull` command is essentially a combo of [`git fetch`](https://git-scm.com/docs/git-fetch) and [`git merge`](https://git-scm.com/docs/git-merge), amalgamating changes from a remote repo into your current branch in Git Bash.

Let’s say you wish to merge a fresh branch into the main in Git Bash. The system would directly employ fast-forwarding without calling `git fetch` or `git merge`. This merging is only plausible if no commits have been made on the primary branch (e.g., master or main) since the inception of the new branch.

![Git Bash git pull default behavior](https://adamtheautomator.com/wp-content/uploads/2023/05/image-437.png)

Choosing the default behavior for Git Bash’s `git pull` command

11\. Finalize your preferences by picking the **Git Credential Manager Core** as the default [Git credential assistant](https://git-scm.com/docs/gitcredentials) and pressing **Next**. These Git Bash credential managers are third-party apps that can be invoked by Git Bash for input data like usernames and passcodes. This info might be temporarily stored in memory or retained on disk for longer durations.

The Git Credential Manager Core, founded on the .NET framework, ensures that Git Bash supports multi-factor authentication via HTTPS.

![Git Bash Credential Manager Selection](https://adamtheautomator.com/wp-content/uploads/2023/05/image-438.png)

Picking the Default Git Bash Credential Manager

12\. For your Git Bash settings, stick to the recommended extra features, as depicted below. By ticking the **Enable file system caching** box, Git Bash will furnish faster outcomes when executing Git commands.

![Git Bash Additional Features](https://adamtheautomator.com/wp-content/uploads/2023/05/image-439.png)

Activating Git Bash’s Additional Features

13\. When setting up Git Bash, it’s advised to retain the default settings for the experimental features below – **[pseudo console](https://learn.microsoft.com/en-us/windows/console/pseudoconsoles)** and **[built-in file system monitor](https://github.com/git-for-windows/git/discussions/3251)**. Once done, hit **Install**.

![Git Bash Experimental Features](https://adamtheautomator.com/wp-content/uploads/2023/05/image-440.png)

Support for Git Bash’s Experimental Features

14\. Once you’ve tailored all the Git Bash settings to your preference, complete the setup process by clicking on **Finish**.

![Git Bash Setup Completion](https://adamtheautomator.com/wp-content/uploads/2023/05/image-441.png)

Git Bash Setup Wizard Completion Screen

15\. To quickly launch the Git Bash terminal, right-click on your desktop and opt for ‘Git Bash Here’ from the dropdown menu. This is a swift way to initiate Git Bash commands, but you can replicate this step even within a specific folder.

![Git Bash Context Menu Option](https://adamtheautomator.com/wp-content/uploads/2023/05/image-442.png)

Choosing ‘Show More Options’ in Git Bash

![Launching Git Bash](https://adamtheautomator.com/wp-content/uploads/2023/05/image-443.png)

Starting Git Bash from the Desktop Context Menu

16\. To ensure that Git Bash commands are functioning and to identify its current version, input the `git` command alongside `--version` in the Git Bash terminal.

```python
git --version
```

As depicted below, in this tutorial, the Git Bash version showcased is **version 2.40.1.windows.1**

![Git Bash Version Verification](https://adamtheautomator.com/wp-content/uploads/2023/05/image-444.png)

Double-checking the Availability of Git Bash Commands

## Utilizing Git Bash Commands in Various Terminals

Having successfully installed Git Bash on your computer, you’re all set to dive into some fundamental Git commands. But remember, the utility of Git Bash isn’t confined solely to its native console. Surprisingly, you can also run Git Bash commands directly from the Windows Command Prompt. Intrigued? Let’s delve in.

Follow these steps to execute Git Bash commands in both the Git Bash console and the command prompt, ensuring you can access variables across both platforms.

1\. To initiate the Git Bash console, click on the Start button, type **git**, and select **Git Bash**.

![Git Bash Launch from Start Menu](https://adamtheautomator.com/wp-content/uploads/2023/05/image-445.png)

Starting Git Bash Commands via the Start Menu

2\. Once in the Git Bash console, input the below [`git config`](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) command to register your name (`YourName`) as your Git username. This `git config` command is the go-to command to manage configurations affecting Git’s behavior and appearance.

By including the `--global` flag, you’re specifying the configuration to be saved in the _~/.gitconfig_ file.

```bash
git config --global user.name "YourName"
```

3\. Now, switch to the command prompt. Here, run the subsequent `git config` command to designate your email address as your Git email. This ensures that every time you perform a commit, Git Bash will recognize it’s you.

```bash
git config --global user.email "TestEmail@mail.com"
```

4\. To get a list of all the configuration variables set in Git, simply run the `git config --list` command in the same command prompt window.

```bash
git config --list
```

From the output below, it’s evident that even if you input configuration variables using separate consoles, Git Bash seamlessly retrieves and displays them in the command prompt.

![Git Bash Configuration Output](https://adamtheautomator.com/wp-content/uploads/2023/05/image-446.png)

Inspecting Global Variables Established via Multiple Consoles in Git Bash

## Using Linux Commands with Git Bash on Windows

Now that you’re familiar with Git Bash, you might be wondering: can it handle Linux commands too? The answer is a resounding yes! Git Bash is versatile. Not only can you run Git Bash commands in its own console, but also directly from the Windows Command Prompt.

For a quick demonstration, try executing the `ls` command (a common Linux command) in both the Git Bash console and the Command Prompt. This command lists the files and folders in the current directory.

Observe the differences in output from the two environments. In Git Bash, the command seamlessly retrieves file and directory listings. However, the Command Prompt initially rejects the unfamiliar Linux command.

![Git Bash Handling Linux Command](https://adamtheautomator.com/wp-content/uploads/2023/05/image-447.png)

Git Bash Successfully Executing a Linux Command

![Command Prompt with Linux Command Error](https://adamtheautomator.com/wp-content/uploads/2021/08/cmd.png)

Command Prompt Struggling with a Linux Command

But don’t lose hope with the Command Prompt just yet! You can enable it to run Linux commands by navigating to the _C:\\Program Files\\Git\\usr\\bin_ directory.

Open the Command Prompt and follow the instructions below to change your working directory and run the `ls` command:

```bash
cd C:\Program Files\Git\usr\bin # Navigate to the directory housing Linux utilities
ls # Execute the Linux command to list files and folders
```

With this adjustment, the Command Prompt now recognizes and correctly executes the `ls` command, producing file and directory listings just like Git Bash.

![Git Bash Commands - Command Prompt Running Linux Command After Adjustment](https://adamtheautomator.com/wp-content/uploads/2023/05/image-448.png)

Command Prompt Adapting to Execute Linux Commands

## Wrapping Up Git Bash Commands on Windows

This guide has walked you through the nuances of Git Bash on Windows. By now, you should understand its capabilities, the ease of running Git Bash commands in multiple environments, and even the compatibility of Linux commands with Git Bash.

So, the next time you’re working with Git commands on your Windows machine, which console will be your first choice?

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fgit-bash-commands%2F&text=Getting%20Started%20with%20Git%20Bash%20Commands%20on%20Windows)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fgit-bash-commands%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fgit-bash-commands%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2024/04/idfix.jpg)

### [Solve Azure AD Connect Errors via the Microsoft IdFix Tool](/idfix/)

Fix Azure AD Connect errors fast with the Microsoft IdFix tool—your go-to solution for seamless synchronization and efficient directory management!

![](https://adamtheautomator.com/wp-content/uploads/2024/04/sandboxie.jpg)

### [How to Install Sandboxie on Windows](/sandboxie/)

Secure your Windows system with Sandboxie. Learn how to install this tool hassle-free and safeguard your digital activities!

![](https://adamtheautomator.com/wp-content/uploads/2022/11/How-to-Install-NitroShare-for-Cross-Platform-File-Transfer.jpg)

### [Install NitroShare and Streamline Your File Transfers Today](/nitroshare/)

Simplify cross-platform file transfers with NitroShare. This tutorial guides you through installation and use for fast, effortless file sharing between different operating systems.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
