Articles

How to Install Git Bash for Windows: Complete Setup Guide

Learn how to install Git Bash shell on Windows. Step-by-step guide to set up bash terminal for Windows with Git Bash download and configuration.

What is Bash?

Bash, or the Bourne Again Shell, is a CLI created in 1989 by Brian Fox as a free software replacement for the Bourne Shell. A shell is a specific kind of CLI. Bash is open source, meaning anyone can read the code and suggest changes. Since its beginning, it has been supported by a large community of engineers who have worked to make it an incredible tool. Bash is the default shell for Linux and Mac up through macOS 10.14 (Mojave). For these reasons, Bash is the most used and widely distributed shell. If you want to learn more about Bash, this Wikipedia article is a good place to start. Better yet, try it yourself with one of our Bash courses.

Related Course

Introduction to Linux: Bash Scripting

Learn about Bash scripting, a powerful way to combine Bash commands, and write Bash scripts to navigate through your operating system.Try it for free

How to install Git Bash Shell on Windows

Windows has a different CLI, Command Prompt. While this has many of the same features as Bash, Bash is much more popular. Because of the strength of the open source community and the tools it provides, mastering Bash is a better investment than mastering the Command Prompt.

To use Bash on a Windows computer, we will download and install a program called Git Bash. Git Bash allows us to easily access Bash as well as another tool we’ll be using later called Git, inside the Windows environment. (If you haven’t used Git before, try out Learn Git & GitHub course.)

You can either watch the following video or read the rest of this article.

Steps to download and set up Git Bash on Windows

1. Navigate to the Git Bash installation page and click the Download button. download 2. Once Git Bash is downloaded, run the downloaded .exe file and allow the application to make changes to your PC. You will get a prompt that says, “Do you want to allow this app to make changes to your device?” Click Yes.

3. To keep things simple, we will use the default settings for everything in this installation, so all you need to do now is keep clicking Next, and finally Finish. setup 4. Open the Start menu by clicking on the Windows icon and typing “Git Bash” into the search bar. The icon for Git Bash and the words “Git Bash Desktop App” will appear. Click on the icon or the words “Git Bash Desktop App” to open Git Bash. openGitBash 5. A new window will open. This is the Git Bash CLI where we will run Bash commands. Whenever a new window of the Git Bash app is opened, you will always be placed in the same directory, your home directory.

The home directory is represented by the tilde sign, ~, in the CLI after MINGW64. The tilde is another way to say /c/Users/username in Git Bash or C:\home\Users\username in Windows’ Command Prompt.

The absolute path of your current working directory, how you got from the root directory to the directory you are currently in, will always be noted at the top of the window:

homeDirectory

Git Bash works by giving you a CLI that acts like a Bash CLI. That means you can now work with your files and folders using Bash commands instead of Windows commands.

Congratulations, you now have Bash installed on your computer, ready to use! In case you wanted to try out the built-in Windows command line for basic system tasks, we talk about it in this article.

Essential Windows Bash commands to get started

Now that you have your Command Line Interface open on your desktop, you are ready to use it. Go ahead and try some of the commands on your personal computer. Here are some good commands for practice:

1. ls to list the contents of the current directory. It may look something like this:

$ ls
Applications Pictures
Codecademy Public
Desktop Downloads
Documents Library

2. mkdir test to make a new directory named test. Now, when you type ls you should see a folder called test:

$ ls
Applications Pictures
Codecademy Public
Desktop Downloads
Documents Library
test

3. cd test to navigate into the new directory. You won’t see an output when you do this.

4. echo "Hello Command Line" >> hello_cli.txt to create a new file named hello_cli.txt and add Hello Command Line to that file. When you type ls, you should see the following:

$ ls
hello_cli.txt

5. cat hello_cli.txt to print the contents of the hello_cli.txt file to the terminal. You should see something like:

$ cat hello_cli.txt
Hello Command Line

Good job! You’re ready to explore the world of the Command Line Interface on your own computer.

Conclusion

Setting up the Command Line Interface (CLI) on a Windows computer using Git Bash is a key step for anyone looking to improve their workflow as a developer. With Git Bash, you can run powerful Bash commands to navigate files, automate tasks, and manage your projects more efficiently, all within a familiar Windows environment.

Ready to go beyond the basics? Dive deeper into Bash with Codecademy’s Learn the Command Line course, where you’ll learn more advanced commands, scripting techniques, and real-world applications.

Frequently asked questions

1. What is CLI and GUI?

A CLI (Command Line Interface) is a text-based interface where users type commands to interact with the system. A GUI (Graphical User Interface), on the other hand, allows users to interact through visual elements like buttons, icons, and windows. CLI is faster and more powerful for advanced users, while GUI is more user-friendly for beginners.

2. Is CLI a programming language?

No, CLI is not a programming language. It’s an interface that allows users to interact with the operating system using command syntax. However, through the CLI, you can run scripts and commands written in scripting languages like Bash, Python, or PowerShell.

3. What is Bash, and why is it used?

Bash stands for Bourne Again Shell and is a popular Unix shell and command language. It’s used for navigating the file system, running programs, and automating tasks using shell scripts. It’s widely used on macOS, Linux, and in tools like Git Bash for Windows.

4. What’s the difference between Bash and Command Prompt?

Bash is commonly used on Unix-based systems like Linux and macOS, while Command Prompt is the default CLI for Windows. Bash offers more powerful scripting capabilities and is favored by developers for automation and working with tools like Git. Command Prompt is more limited in comparison.

5. Do I need to know CLI to use Git?

Yes, a basic understanding of the Command Line Interface is helpful for using Git effectively. Most Git workflows like cloning repositories, committing changes, or pushing code are commonly done via CLI tools such as Git Bash.

Codecademy Team

'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'

Meet the full team