Install Git Bash on Windows Easily – Beginner’s (Step-by-Step) Guide
Git is a version control system (VCS) that is open source and used as a DevOps tool for managing source code. It can efficiently handle projects ranging in size from very small to very large. Git is used to log changes that have been made to the source code. It also provides support for non-linear development, which enables several developers to collaborate in a manner that is nearly real-time. You will find a detailed, step-by-step instruction to installing Git on Windows 10 within this article, which is titled “Git Installation on Windows.” Let’s get started.
How to Install Git Bash on Windows
While downloading Git for Windows from the official website is simple, it is important to carefully follow the instructions to prevent future syncing issues. We provide a beginners’ guide to installing Git for Linux users.
Git Bash download page
Select the components you want to install after downloading them, and remove any that you don’t. As mentioned below, accept the GNI General Public License.
Git Bash License Page
The parameters “Git Bash” and “Git GUI,” “enable Git support for large files,” “associate.git configuration files with the default text editor,” and “associate.sh files to be run with Bash” must all be enabled at the very least.
Git Bash Components
Users of Windows 10 will notice that “Program Files” will automatically generate a Git folder. You have the option to omit making a Start menu folder. You will also have the option to choose the default Git editor in the following stage. Vim is the standard editor, but there are also a number of alternative choices, including Notepad++, Atom, Visual Studio Code, and Sublime Text. Vim is what we’re using for this tutorial. You will then be prompted for the name of the first branch. To add the name as “let Git decide” is safer. Pick the suggested option, “Git from the command line and also from 3rd-party applications,” to modify the path environment.
Git Bash Path Environment
You need to select the HTTPS transport backend in the following step. The OpenSSL library should be used for stronger authentication.
Git Bash Transport Backend
Text file line endings are another Git convention. Select “Commit Unix-style line endings, check out Windows-style line endings.”
Git Bash Line Endings Windows Style
Of course, using Git Bash requires a terminal emulator. Select MinTTY as your preferred terminal instead of the Windows 10 default console window. This will make it easier for you to keep your Git operations distinct from the other PC processes. Additionally, the MinTTY window has the same same interface as a command terminal.
Git Bash Default Terminal MinTTY Chosen
Git “Pull” requests: how should they be handled? Pick this default selection.
Default Behavior of Git Pull
Select “Git Credential Manager Core” to handle your GitHub and other third-party credentials.
Git Bash Credential Manager
There are also other configuration choices. Selecting “enable file system caching” will improve performance. The following screen also contains certain untested features that are safe to ignore, including phoney consoles.
Git Bash Extra Options
Git installation on your computer will take a little while longer.
Git Bash Git Installing
You can start Git Bash or open the programme terminal from the Windows search box in “Administrator” mode after the Git Setup Wizard has finished installing Git.
Git Bash Setup Wizard
You can start exploring with different Git features, such Git Aliases, now that you know how to correctly install the Git Bash terminal emulator on Windows 10. We also spoke about how to set up GitHub project management. Jekyll and GitHub Pages both offer free blog hosting options.
Git Installation on Windows
Let’s examine the various procedures involved in installing Git on Windows now.
Choose the 64/32 bit version of Git when downloading the most recent version. Install the file into the system after it has been downloaded. Select Launch the Git Bash after installation is complete, then click Finish. The Git Bash has started.
Check the Git version:
|$ git –version|
For any help, use the following command:
|$ git help config|
You can browse configuration commands by entering this command. In essence, the help the command offers is a manual taken from the help page for the command that comes immediately after it (in this case, config). The following is another way to execute the same command:
|$ git config –help|
Create a local directory using the following command:
|$ mkdir test $ cd test|
The next step is to initialize the directory:
|$ git init|
Make a text file called “demo” in the same folder as “test” was created. Enter any content, such as “Hello Simplilearn,” in the “demo” box. Save the document, then exit.
To verify the status, use the following command into the Git bash interface:
|$ git status|
Add the “demo” to the current directory using the following command:
|$ git add demo.txt|
Next, make a commit using the following command:
|$ git commit -m “committing a text file”|
Link the Git to a Github Account:
|$ git config –global user.username|
Note: simplilearn-github is the username on the Github account.
To verify the status, enter the command below in the Git bash interface:
Go back to Git bash and link the remote and local repository using the following command:
|$ git remote add origin <link>|
Here, <link> is the link copied in the previous step.
Push the local file onto the remote repository using the following command:
|$ git push origin master|
Move back to Github and click on “test_demo” and check if the local file “demo.txt” is pushed to this repository.
What is the difference between the terms Git and Git Bash?
Git – is a distributed version control system that makes it simple to monitor changes and allows you to compare many draughts of the same source code document. In this article, you will learn how to run a quick command to verify that Git is correctly installed and operating as expected after completing the download and installation of Git commands for Windows.
Git bash is not a GUI application. Instead, you will only utilise the command line prompt to type and execute commands. As we will only be covering Git commands in this first version of the lesson, we will only be covering Git bash on Windows and will not be covering any third-party Git client GUI software. The identical installation package for Git GUI that is shown later in this post is included with it, but we won’t go through it here. The procedures below should be followed in order to download and set up Git bash on Windows:
Windows administrator access is required. Optional: – Visual Studio Code: You only need to test and set up git integration with it if you use VS Code to develop separate apps. – Visual Studio 2019: Only if you want to use source control with Git on your Visual Studio and you are a.Net developer.
Download Git Bash for Windows
Let’s get started by downloading the setup file before bringing Git Bash to your Windows. To begin downloading, take the following actions: Please launch your preferred web browser and navigate to https://git-scm.com.
As seen in the screenshots below, the download button is currently located on the right side of the Git SCM and at the top of the GitHub link. Click the “Download for Windows” button now.
To download the client version 2.33.0 immediately, click the image above. You will be taken to another website with some download options after clicking the button, as seen below. “Click here to download manually” should be clicked.
The “download” button can also be located at the top of the home page of https://gitforwindows.org, as illustrated below.
Furthermore, by visiting https://git-scm.com/downloads and selecting “Linux” or “Mac,” as shown below, you can download the Git bash client for Linux or Mac.
Install the Downloaded Git bash Client
You should have Git setup files on your Windows computer ready for installation if you followed the previous download instructions. There are no limitations on the Windows version or build; we will offer the installation instructions for the most recent version of Windows Server 2016 by the time this post is published. By doing the following steps, you can begin the installation: In the “GNU General Public License” window, click Next after opening the setup file you downloaded earlier.
You can modify the installation path on the “Select Destination Location” dialogue; otherwise, click Next.
You can choose the components shown in the following screenshot on the “Select Components” panel. It’s up to you whether you want to put an icon on the desktop or not. Click Next once you’ve finished setting up your options. It’s optional to rename the start menu folder or even click the box that says “Don’t create a Start Menu folder” at the bottom of the “Select Start Menu Folder” dialogue. then press Next.
Feel free to use any editor in the – Choosing the default editor used by Git – stage, such as Notepad++ or Visual Studio Code. Personally, I like to click Next while leaving the default option selected.
Unless you want to give your initial branch a default name other than “master,” leave the default pick on the – Adjusting the name of the initial branch in new repositories – step, then click Next.
Leave the default choice and press Next on the dialogue titled “Adjusting your PATH environment.”
Click Next after selecting “Use the native Windows Secure Channel library” in the “Choosing HTTPS transport backend” window.
In the panel labelled “Configuring the line ending conversions”:
If your team will alternate between working on Windows and Unix machines while using the Windows platform, select “Checkout Windows-style, commit Unix-style line endings.” Cross-platform is supported by this choice.
In the event that separate Windows and Unix platforms will be used by you and your team, select “Checkout as-is, commit Unix-style line endings.” Cross-platform is supported by this choice as well.
If you and your team will only be using Windows and cross-platform will not be supported, select “Checkout as-is, commit as-is.”
I would rather leave the default choice. But once you’ve made your own decision, press Next.
Leave the default selection of Use MinTTY (the default terminal of MSYS2), which uses the bare-bones terminal emulator for bash, and then click Next on the “Configuring the terminal emulator to use with Git Bash” dialogue.
Leave the default selection on the – Choose the default behaviour of git pull – screen, then select Next.
The popup labelled “Choose your credential helper” should now appear. Click Next after leaving the default option selected.
Leave the default choices to reflect the screenshot below on the Configuring extra options window, then click Next.
It is entirely up to you whether to enable any of these recently introduced experimental options at the – setting experimental options – phase. Click Next after you have had a chance to look them over on your own.
After completing this step, the installation progress should now be running as seen below.
On the “Completing the Git Setup Wizard” window, click Finish after unchecking “Launch Git Bash” and “View Release Notes.”
You should now be able to see the Git bash icon on your desktop as a result of the previous procedures.
Testing Git bash Windows installation
The actions listed below will determine whether Git bash has been correctly installed and is responding to Git commands as anticipated:
- Double-click the desktop icon for “Git Bash.” You should see the Git bash terminal open, and this is where you should enter your Git commands.
- Enter the upcoming command:
- Git should reply with the Git version and the platform that is running Git bash, as seen in the following screenshot.
Git bash Windows configurations
Now that Git has been installed, commands are being successfully executed. However, in order for Git to manage repositories, it needs to be given access to two fundamental parameters. Just your name and email are listed under those settings. To configure Git with that necessary data, take the following actions:
- Make sure your Git bash command prompt is open.
- Apply the following command to configure your name:
git config –global user.name “Your Name” Then apply the next command to configure your email:
git config –global user.email “firstname.lastname@example.org” To make sure that both configurations have been set correctly we can check by typing the following command:
git config –global –list Which will list all the global configurations that have been set for Git so far as shown in the below screenshot
Git configurations explained
You can easily skip this step if you’re not interested in learning how Git configured the username and email. As demonstrated in the configuration commands before:
- Git configurations are often set or obtained using the git config command.
- Both —global and —system can be used as parameters after git config to help Git quickly locate the configuration file to edit and change the specified configurations.
- Git is instructed to look in the system-wide configuration file, /etc/gitconfig, which is applicable to all users.
- Git is instructed to look for the user-specific /.gitconfig configuration file by using the —global flag. For this reason, configuring the username and email with —global for a specific user rather than —system for all users made sense.
- The username and email are set via user.name and user.email.
- Git configurations can be obtained or changed without using commands; instead, you can do so by directly editing the configuration files.
Extra optional configurations
We have successfully configured Git at this point, and it is ready to offer various repository management commands. However, if you’re curious about other options, some further configurations might be of interest. Controlling Git colours is one of those intriguing options, as an example. The majority of Git’s output on Git bash is displayed in a colourful format by default. However, you can disable this feature if you don’t like it by using the following command:
—global color.ui false in git configuration The colours can also remain active while being altered using different setups. you can visit Git – Git Configuration. for further details on how to manage the other configurations.
Some useful Windows Git bash commands
You will learn two key fundamental commands in this section that are crucial to understand because you will use them frequently throughout this lesson. Make sure Git Bash is open, then enter the following command:
pwd The current directory location will be returned in response to this command. For instance, the command pwd provided the root location in the screenshot below. then enter the command that follows:
As seen in the screenshot below, the ls command will essentially respond by listing all of the files and folders at the current location. It looks that the default location of the ls command and the location of git-bash.exe are the same. To create projects and files at this location is not a recommended best practise. Therefore, you can use the standard cd command to change the default location, but it differs slightly from the cd command that you type in your Windows command prompt. Open the C drive in file explorer, create a new folder called “Git Projects,” and then enter the command below while your Git bash terminal is open:
Git won’t be able to locate your location if the double quotes are not present. Consequently, double quotes are required in Git bash but not in Windows command prompt (only if there are spaces in the target location). The outcome would now resemble the screenshot seen below. It is clear from the screenshot above that the cd command changed the current location after being executed.
You will now obtain different outcomes if you execute the ls command again. An option to using the cd command is to right-click anywhere in your Windows file explorer while your Git terminal is closed and navigate to the newly created “Git Projects” folder. As seen in the screenshot below, the Windows file explorer context menu should have two Git options: “Git GUI Here” and “Git Bash Here.”
The same as running the cd command, clicking “Git Bash Here” should launch Git bash with your location set to the “Git Projects” folder. As a result of the installation process described in the installation section, the two additional choices “Git GUI Here” and “Git Bash Here” are available: Integrate “Git Bash Here” or “Git GUI Here” with Windows Explorer. You can use the following command to ask Git for more information about the various git configurations:
config help in git As seen in the screenshot below, the preceding help command will launch your normal browser and open an HTML page with all the information you could possibly need about Git setups.
Git on Visual Studio Code
You can utilise the Git visual integration as displayed in the following screenshot if you’re using Visual Studio Code to create any kind of application, including React, Angular, or other types.
When you select the source control icon for Git on the left, you have the option to either “Open Folder” to launch an already-mapped project or “Clone Repository” to download a fresh copy of a remote repository to your local machine.
Git on Visual Studio 2019
You can use Git on Visual Studio 2019 if you’re a Microsoft.Net developer creating ASP.NET web applications or Windows applications by cloning a new repository, as seen in the accompanying screenshot.
Summary: Install Git Bash on Windows Easily
The installation of Git bash on Windows is incredibly straightforward, and the programme gives us access to a substantial number of configurations and options that the installation wizard is able to manage. As a result, setting up and configuring Git bash is a breeze. You are now prepared to use Git bash as a command terminal for set source control in order to create and manage Git repositories.
You have now completed the installation and configuration of Git, and are prepared to utilise it with your projects. It is strongly suggested that you move on with this by reading the second article in this series, which is titled “The 3 Ways to Create Git Local and Remote Repositories.” You will gain an understanding of how Git operates and learn how to begin using Git bash commands to either link an existing local project to your machine or clone a new remote repository to your machine if you read that page.