Before you can use Git, it has to be installed on your computer. This lesson walks you through installing Git on Windows (with the installer or winget) and on the most popular Linux distributions, with the installer options that matter and fixes for common problems.
📖 What You’ll Learn: checking for an existing Git, the Git for Windows installer and its key options, installing with winget, installing on Ubuntu, Fedora, Arch and others, updating Git, and troubleshooting.
✅ Before You Start
Check whether Git is already installed. Open a terminal (Command Prompt, PowerShell or Windows Terminal on Windows; Terminal on Linux) and run:
git --version
If you see something like git version 2.47.1, Git is installed; you can still follow this lesson to update it. If you see “command not found” or “‘git’ is not recognized”, install it now.
On a Mac? Follow Install Git on macOS instead, then continue with Configure Git.
🪟 Install Git on Windows (Installer)
- Go to git-scm.com and click Download for Windows. Choose the 64-bit Git for Windows Setup installer.
- Run the installer. Most default options are fine; these are the important screens:
| Installer screen | Recommended choice | Why |
|---|---|---|
| Choosing the default editor | Visual Studio Code (or Notepad++) | The default, Vim, is hard for beginners |
| Adjusting the name of the initial branch | Override… and use “main” | GitHub uses main as the default branch name |
| Adjusting your PATH environment | Git from the command line and also from 3rd-party software | Lets you use git in PowerShell, CMD and VS Code |
| SSH executable | Use bundled OpenSSH | Works with the SSH lesson |
| Line ending conversions | Checkout Windows-style, commit Unix-style | Avoids line-ending problems with teammates on macOS and Linux |
| Terminal emulator | Use MinTTY | Better Git Bash terminal |
| Default behaviour of git pull | Fast-forward or merge (default) | Explained in fetch vs pull |
| Credential helper | Git Credential Manager | Signs in to GitHub securely in the browser |
- Click Install, then Finish.
- Open a new terminal and verify:
git --version
⚠️ Common mistake: If git is still “not recognized”, close every terminal and VS Code window and open them again so they pick up the updated PATH. If it still fails, re-run the installer and check the PATH option above.
What did the installer add?
- Git Bash: a Linux-style terminal for Windows. Commands in this course such as
ls,catandtouchwork there. See Essential Terminal Commands for Git. - Git GUI: a simple graphical tool (rarely needed).
- Git Credential Manager: stores your GitHub login securely.
⚡ Install Git on Windows with winget
Prefer the command line? Windows 10 and 11 include the winget package manager:
winget install --id Git.Git -e --source winget
Close and reopen the terminal, then run git --version. winget uses the installer defaults, so set the default branch name and editor in the next lesson.
🐧 Install Git on Linux
Use your distribution’s package manager:
# Ubuntu, Debian, Linux Mint
sudo apt update
sudo apt install git
# Fedora
sudo dnf install git
# CentOS Stream, RHEL, Rocky, AlmaLinux
sudo dnf install git
# Arch Linux, Manjaro
sudo pacman -S git
# openSUSE
sudo zypper install git
Verify:
git --version
📝 Note: Distribution packages can be a few versions behind the latest Git release. That is fine for this course. On Ubuntu you can get newer versions from the official Git PPA: sudo add-apt-repository ppa:git-core/ppa, then sudo apt update && sudo apt install git.
🔄 Updating Git Later
| Platform | Update command |
|---|---|
| Windows (Git for Windows 2.16.1 or newer) | git update-git-for-windows |
| Windows (winget) | winget upgrade --id Git.Git |
| Ubuntu or Debian | sudo apt update && sudo apt install --only-upgrade git |
| Fedora | sudo dnf upgrade git |
🐞 Troubleshooting
| Problem | Fix |
|---|---|
'git' is not recognized on Windows | Reopen the terminal; re-run the installer with the PATH option “from the command line and also from 3rd-party software” |
| VS Code does not find Git | Restart VS Code; check Settings, git.path |
Permission denied on Linux | Use sudo for the install command |
| Old version on Linux | Use the distribution’s backports or the Git PPA (Ubuntu) |
| Corporate proxy blocks downloads | Ask IT for the approved installer, or download on another network |
📝 Assignment
- Install Git on your computer and paste the output of
git --versioninto a notes file. - On Windows, open Git Bash and run
pwd,lsandcd ~. What does each command show? - Open VS Code, open any folder, and check that the Source Control panel (Ctrl + Shift + G) no longer says Git is missing.
- Write down which line-ending option you chose during installation, and why it matters for teams.
❓ FAQ
🤔 How do I install Git on Windows?
Download Git for Windows from git-scm.com, run the installer (choose VS Code as editor, “main” as the default branch and the recommended PATH option), then check git --version in a new terminal. Or run winget install --id Git.Git -e --source winget.
🤔 How do I install Git on Ubuntu?
Run sudo apt update and sudo apt install git, then verify with git --version.
🤔 How do I check if Git is installed?
Open a terminal and run git --version. If it prints a version number, Git is installed.
🤔 What is Git Bash?
A terminal installed with Git for Windows that supports Linux-style commands such as ls, cat and rm, which makes following Git tutorials easier on Windows.
🤔 Do I need a GitHub account to install Git?
No. Git works without an account. You will create a GitHub account in Lesson 6 to share your repositories online.
🎯 Next Steps
- 🍎 Install Git on macOS
- ⚙️ Configure Git: Name, Email, Editor and Defaults
- 📘 Git and GitHub Tutorial: full course
🎬 Learn Git and GitHub step by step: watch the series on YouTube!
Subscribe to SqaToolsByDY • Practice on sqatools.in
4 thoughts on “How to Install Git on Windows and Linux (Step by Step)”