Git Bash is a terminal emulator for Windows, used for a Git command line experience. With Git Bash, you can work on any changes in the code in the terminal itself, without the need for another coding environment, such as Atom, Notepad++, etc. Follow the various methods in this guide to install Git and Git Bash on Windows. When you add Git Bash as a program in Windows, it installs the entire Git version control system.
Good to know: need a text editor? Check out this list of the best cross-platform options for programmers.
How to Install Git Bash/Git in Windows
There are four different methods to install Git Bash/Git in Windows, and each has its advantages. The first method is the complete instructions for a regular Git installer, while the other methods are shortcuts that lead to the same results.
1. Using Git Installer for Windows
Installing Git for Windows is a breeze, but you should carefully check the steps to avoid syncing errors later.
- Click the Windows link on the download page.
- You will see multiple download links. If you’re looking for a regular installer, choose the latest 64-bit version for Windows.
- Accept the GNU General Public License.
- Select a destination location on your Windows device.
- Select the components you want to install and clear the ones you don’t. At the minimum, you will need to enable the options for “Git Bash,” “Git GUI,” “Git LFS (Large File Support),” “Associate .git configuration files with the default text editor,” and “Associate .sh files to be run with Bash.” In most cases, these required options should be enabled by default.
- A Git folder will be created as the default in Program Files. You can opt not to create a Start Menu folder.
Tip: check out these useful YouTube channels that can teach you how to code.
Customizing Your Installation
In the next step, you will have the option of choosing the default editor by Git.
- While Vim is the default editor, you will find many other options, such as Notepad++, Atom, Visual Studio Code, and Sublime Text. For this tutorial, we are using Vim.
- Select the initial branch name or leave it up to Git. It’s safer to select “Let Git decide.”
- Select the recommended PATH environment of “Git from the command line and also from 3rd-party software.”
- Select “Use bundled OpenSSH” as your secure shell (SSH) client executable.
- Choose the HTTPS transport backend, “Use the OpenSSL library,” for superior authentication.
- Another Git convention is to configure line endings in text files. Select “Checkout Windows-style, commit Unix-style line endings.”
- You need a terminal emulator to use with Git Bash. Opt for MinTTY, the default terminal of MSYS2, instead of your Windows console window. This keeps Git programs separate from what you do in Command Prompt.
- Select the “Default” option for the behavior of “git pull” requests.
- To manage your GitHub and other third-party credentials, select “Git Credential Manager.”
Tip: if you’re new to Git, get up to speed with our full beginner’s guide.
Additional Options
There are also some extra options that you need to configure in a regular installation of Git for Windows.
- Select “Enable file system caching” for enhanced performance boost.
- It’s safe to ignore the experimental options, such as pseudo consoles.
- It will take a few minutes for the Git installation to finish.
- You can launch Git Bash after the Git Setup Wizard is finished.
- Alternatively, locate the Git Bash application in Windows search or open the executable from the folder where it is installed.
- The MinTTY terminal emulator should be visible. This will help you keep your Git operations separate from the remaining PC functions. The MinTTY window feels the same as the command terminal.
Tip: did you know that you can add screenshots and animations to GitHub, pull requests and operate them from your Git Bash window?
2. Using Git Portable Version
Apart from the lengthy regular installer, Git also has a portable version for Windows, which is very handy.
- Go to the Git Download for Windows page and click the Windows Portable download link.
- Save the Portable .ZIP file in a folder of your choice.
- You can change the Git portable installation destination by clicking the three-dot icon.
- Wait for the portable installer to extract completely.
- Once the process is complete, you’ll find the portable folder nested inside “Git Bash Install Windows.”
- Launch the Git Bash application from the PortableGit folder, then save it to a USB drive, if you wish.
- MinTTY emulator describes itself as a portable terminal, but it’s no different than a regular terminal, and you can use all your Git commands here.
Tip: do you use portable apps often? Learn how to add them to Windows startup.
You can use the Winget command-line tool to install Git/Git Bash in Windows.
- Install the App Installer Microsoft Store application on your computer.
- Open Command Prompt in administrator mode.
- Type
winget
to verify that the App Installer program has been installed correctly. It will show various commands you can use with Winget.
- Install Git using Winget in Command Prompt by typing the following code:
winget install --id Git.Git -e --source winget
- It can take up to a minute for Git to install through Winget in the Command Prompt. You may also find an installer pop-up window.
- Check for a “Successfully installed” message in Command Prompt.
- Once the Git Setup Wizard finishes installing Git, launch Git Bash or open the program terminal from the Windows search box in Administrator mode.
Good to know: are Windows 11 widgets not working for you? Try these solutions.
4. Chocolatey
Chocolatey is a Windows program in PowerShell that can quickly help you install the full version of Git/Git Bash. It’s like a wrapper around any target application that is being installed.
- Open PowerShell in Administrator mode.
- Install Chocolatey in Windows using the following command. You will not get any message confirming that installation was successful. Once the process is complete, close the PowerShell window, then restart.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- In the new PowerShell window (Administrator mode), type the following to install Git using Chocolatey.
choco install git.install
- Click “A” or “Y” to grant the permissions required by Chocolatey.
- Once Git is installed on your device, you should see a success message in the PowerShell window.
Good to know: want to learn how to use PowerShell? You’ll need this list of essential commands.
Frequently Asked Questions
What is the difference between Git and GitHub?
Git is an open-source version control system whose repositories are hosted on GitHub, an online collection of Git source codes. GitHub is owned by Microsoft; however, its open-source nature has not changed because of the ownership. You need Git to run many GitHub projects, but it’s not true in the reverse, as there are alternatives to GitHub, such as GitBucket, GitLab and SourceForge.
What is the difference between Git and Git Bash?
Git is the original Unix-based version control system launched in 2005 by Linus Torvalds for tracking code changes in multi-user collaboration projects on Linux and Mac. Bash is another Linux-specific command-line shell based on Unix.
Microsoft’s operating system isn’t natively designed for Bash, a Linux-specific command-line shell. Therefore, Windows users must install Git Bash, a third-party software that is a customized Terminal Emulator designed specifically for Windows. With Git Bash, you can operate both Git and Bash together in Windows.
Can Git be completely uninstalled from Windows?
You can completely uninstall Git from Windows by uninstalling the Git Bash application from “Add or remove programs” in Settings or by going to Control Panel and clicking “Uninstall a program” under Programs and Features. Locate the Git folder in C:\ drive using the Windows search menu, then delete it. If you are using the portable version of Git in Windows, delete the Git folder, as no other installation was done.
Image credit: DepositPhotos. All screenshots by Sayak Boral.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
اكتشاف المزيد من نص كم
اشترك للحصول على أحدث التدوينات المرسلة إلى بريدك الإلكتروني.