Easiest Way to Download Git Bash Commands on Windows

Easiest Way to Download Git Bash Commands on Windows

The easiest guide to Git Bash for windows download and, the basic configurations needed to install Git bash commands to manage your repositories

Easiest Way to Download Git Bash Commands on Windows

The best way to define Git bash (for Windows, Linux, or Mac) is that it's a source control management system that you can download and install on your computer where you will be able to type some Git commands to make source code management easier through versioning and the commit history.

What is the difference between the terms Git and Git Bash?

Git - is a distributed version control system that makes tracking changes very easy where you can compare between different versions of the same source code file.

In this post, after you finish Git commands Windows download and installation you will run a simple command to make sure that Git is adequately installed and responding to the commands as expected. 

Git bash - is not a GUI software. Instead, it's a command line prompt where you will only use to write and run commands. 

In this first version of this tutorial, we will not cover any third-party Git client GUI software as we will just focus on Git commands and that's why we will provide the steps of downloading and installing Git bash only and on Windows. 

Git GUI is shipped with the same installation package as shown later in this post but we will not cover that as well.

To download Git bash and install it on Windows, follow the next steps:

  1. Download Git Bash for Windows.
  2. Install the Downloaded Git Bash Client.
  3. Testing Git bash Windows installation.
  4. Git bash Windows Configurations.
  5. Some useful Windows Git bash commands.
  6. Git on Visual Studio Code.
  7. Git on Visual Studio 2019.
  8. Summary: Git bash installations and configurations on Windows.

Software Prerequisites

Mandatory:

Windows administrative access.

Optional:

- Visual Studio Code: Only in case you use VS code in different app developments, you will need to test and configure git integration with it.
- Visual Studio 2019: Only if you are a .Net developer and would like to use source control with Git on your Visual Studio.

Download Git Bash for Windows

Let's get straight to bringing Git Bash to your Windows by firstly downloading the setup file. 

To start downloading, follow these steps:

I want you to open your favorite web browser, and go to https://git-scm.com.

By the time of writing this post, you will find the download button on the right side of the Git SCM and at the top of the GitHub link as shown in the screenshots below. Now click the button "Download for Windows".

Download the latest Git bash version for Windows
Click on the image above to download the client version 2.33.0 directly.
Once you click the button, you will be redirected to another page with some download options as shown below. Click on "Click here to download manually".
Click here to download manually
Alternatively, open https://gitforwindows.org/ and click the "download" button found at the top of the home page as shown below.

Download Git for Windows from GitForWindows

Furthermore, you can download the Git bash client for Linux or Mac but going to https://git-scm.com/downloads and click on "Linux" or "Mac" as shown below.

Download Git bash for Linux or Mac

Install the Downloaded Git bash Client

By following the previous download steps, you should have Git setup files on your Windows machine ready for installation.

We will provide the installation steps on the latest Windows Server 2016 by the time of writing this post, and you can use any Windows version you prefer, there are no restrictions with the Windows version or build.

You can start the installation by following these steps:

Click the setup file you downloaded in the earlier steps and on the "GNU General Public License" window, click Next.

Click next on the GNU public license
On "Select Destination Location" window you can change the installation path, otherwise, just click Next.

Select Destination Location
On "Select Components" window, You can select the components that match the screenshot below. I prefer to place an icon on the desktop but that's up to you.

Once you complete configuring your preferences, click Next.

On the "Select Start Menu Folder" window, it's optional to rename the start menu folder or even check "Don't create a Start Menu folder" at the bottom. Then click Next.

Select Start Menu Folder
In the - Choosing the default editor used by Git - step, feel free to select any editor like Notepad++ or Visual Studio Code. I, personally, prefer to leave the default selection and just click Next.

Choosing the default editor used by Git
On the - Adjusting the name of the initial branch in new repositories - step, leave the default selection unless you want to give a default name to your initial branch rather than "master", then click Next.

Adjusting the name of the initial branch in new repositories
On the - Adjusting your PATH environment - window, leave the default selection and, click Next.

Adjusting your PATH environment
On the "Choosing HTTPS transport backend" window, select "Use the native Windows Secure Channel library" option then click Next.

Choosing HTTPS transport backend
On the "Configuring the line ending conversions" window:
  • Choose "Checkout Windows-style, commit Unix-style line endings" in case you will be using Windows platform, but your team will be bouncing from working on Windows to Unix machines and vice versa. This option supports cross-platform.
  • Choose "Checkout as-is, commit Unix-style line endings" in case you and your team will be using different Windows and Unix platforms. This option also supports cross-platform.
  • Choose "Checkout as-is, commit as-is" in case you and your team will be using Windows only and cross-platform will not be supported.
I prefer leaving the default selection. But, once you decide for yourself, click Next.

Configuring the line ending conversions
On the "Configuring the terminal emulator to use with Git Bash" window, leave the default selection at - Use MinTTY (the default terminal of MSYS2) - which uses the minimal terminal emulator for bash then click Next.

Configuring the terminal emulator to use with Git bash
On the - Choose the default behavior of git pull - leave the default selection, then click Next.

Choose the default behavior of git pull
Now you should see the - Choose your credential helper - window. Leave the default selection then, click Next.

Choose a credential helper
On the - Configuring extra options - window, leave the default selection to match the screenshot below then, click Next.

Configuring extra options
At the - configuring experimental options - step, it's completely up to you to enable any of these newly developed experimental options. Feel free to explore them on your own then, click Next.

Configuring experimental options
Now, you should see the installation progress running after this step as shown below.

Installing Git bash
Once you finish the installation, uncheck "Launch Git Bash" and "View Release Notes" on "Completing the Git Setup Wizard" window and click Finish.

Completing the Git setup wizard

By following the previous steps, you should now notice the Git bash icon added to your desktop.

Testing Git bash Windows installation

The following steps will check if Git bash has been appropriately installed and responding to Git commands as expected:

  1. Double click the "Git Bash" desktop icon. Git bash terminal should open up, and this is where you will write your Git commands.
  2. Type in the following command:

Git should respond by providing the Git version and the platform running Git bash as shown in the next screenshot.

Testing the Git bash installation by running the git version command

Git bash Windows configurations

Now Git has been installed and responds correctly to commands. 

However, it's required to provide Git with two basic configurations to be able to manage repositories. 

Those settings are merely your name and your email. To configure Git with that required information follow these steps:

  • Make sure your Git bash command prompt is open.
  • Apply the following command to configure your name:

Then apply the next command to configure your email:

To make sure that both configurations have been set correctly we can check by typing the following command:

Which will list all the global configurations that have been set for Git so far as shown in the below screenshot

Git global configurations

Git configurations explained

If you're not interested to know how Git worked to configure the username and email you can safely skip this sub-section.

As shown in the previous configuration commands:

  1. git config is primarily used to set or get any Git configurations.
  2. After git config, both --global or --system can be used as a parameter to let Git easily find the configuration file to edit and modify the supplied configurations.
    1. --system tells Git to look for the configuration file placed system-wide /etc/gitconfig which applies to every user on the system.
    2. --global tells Git to look for the configuration file set at the user level ~/.gitconfig which is specific to each user. That's why it made sense to configure the username and email with the --global for a particular user and not with --system for all users.
  3. user.name and user.email will set the username and email.
  4. It's not necessary to get or set Git configurations through commands; you can manage the settings by editing the configuration files directly.

Extra optional configurations

At this step, we have successfully configured Git and ready to provide different repository management commands, but if you'd like to know more about other settings, some extra configurations might be of interest.

For example, one of those interesting configurations is controlling Git colors. 

Git, by default, displays most of its output on Git bash in a colored format. However, if you do not prefer this feature you can turn it off by applying the following command:

You can also leave the colors running but change them through other configurations. For more information about how you can manage the extra configurations, you can visit Git - Git Configuration.

Some useful Windows Git bash commands

This section will provide two important basic commands that you are going to find frequently throughout this tutorial, so it's essential to know more about them. Make sure you open Git bash and type in the following command:

This command will respond with the current directory location. For example, in the screenshot below, the command pwd responded with the root location.

Then type in the following command:

This command will basically respond with listing all the files and directories at the current location as shown in the below screenshot.

Apparently, it appears that the default location of the ls command is the same as the path where git-bash.exe is. Which is not desired as a best practice to create projects and files at this location. 

So, to change the default location, you can use the traditional cd command, but it's a little different than the cd command that you type in your Windows command prompt.

Go to your file explorer and open the C drive and create a new folder called "Git_Projects" and while your Git bash terminal is open, write the following command:

Make sure you include the double quotes otherwise Git will not be able to find your location. So the double quotes are mandatory in Git bash which is not the case in Windows command prompt (only if there are spaces in the target location). 

Now the result would be something like the screenshot below.

After running the cd command and as shown in the screenshot above, it's obvious that the command changed the current location. 

Now if you rerun the ls command you will get different results.

An alternative to running the cd command is, while your Git terminal is closed, on your Windows file explorer, go to the created "Git_Projects" folder then right-click anywhere. 

You should find two Git options in the Windows file explorer context menu which are "Git GUI Here" and "Git Bash Here" as shown in the screenshot below. 

Click "Git Bash Here", and that should open Git bash with your location set to the "Git_Projects" folder precisely the same as running the cd command.

The two new options "Git GUI Here" and "Git Bash Here" are the result of the installation step mentioned in the installation section:

Integrate windows explorer with "Git Bash Here" or "Git GUI Here".

For more details about the different git configurations you can ask Git itself for help through the following command:

The previous help command will open an HTML page on your default browser containing all the bits and pieces you would need to know about Git configurations as shown in the screenshot below.

Git local configuration help

Git on Visual Studio Code

If you are using Visual Studio Code to develop React, Angular, or any type of applications, you can use the Git visual integration as shown in the following screenshot.

Git on VS Code
Once you click Git's source control icon on the left, you can either choose to "Open Folder" to open an existing project that's already mapped to a Git remote repository, or "Clone Repository" to clone a new remote repository on your local machine.

Git on Visual Studio 2019

If you are a Microsoft .Net developer building ASP.NET web application or Windows applications, you can also use Git on Visual Studio 2019 by cloning a new repository as shown in the following screenshot.

Git on Visual Studio 2019

Summary: Git bash installation and configurations on Windows

Git bash installation is super easy on Windows, and it provides us with a considerable amount of configurations and options that the installation wizard can handle which makes it very easy to setup and configure. 

Now you are ready to use Git bash as a set source control command terminal to create and manage Git repositories.

Next Step: Create, Clone and Work with Git Local and Remote Repositories

At this step, you installed, configured, and ready to use Git with your projects. I recommend that you take this to the next step by reading my second article about the 3 Ways to Create Git Local and Remote Repositories.

In that post, you will understand how Git works and learn how to start using Git bash commands to either connect an existing local project or, clone a new remote repository to your machine.
Did you find this helpful?

Read Next

The following articles are related to easiest way to download git bash commands on windows.

Share:
Easiest Way to Download Git Bash Commands on Windows
Fady Soliman
Fady SolimanMember since
Jun 22, 2013
Loading...
1 Comment

Nice piece

Contact Us
Share your COMMENT!

Share your thoughts and feedback on Easiest Way to Download Git Bash Commands on Windows

Ask any questions directly to Fady Soliman and the community!

By using this channel you approve that you agree on our Terms and Conditions