Git installation takes five minutes and works the same way on all operating systems
Git is a program you download and install once, then use from your computer's command line or through a graphical interface. The installation itself is straightforward: you visit the official Git website, download the installer for your operating system, run it, and accept the default settings. After that, Git is ready to use.
The reason to install Git directly—rather than relying on a version that might come bundled with other software—is that you control when you update it and you know exactly where it lives on your computer. This matters when you start working with repositories and need to troubleshoot connection problems.
Key Takeaways
- Download Git from git-scm.com, the official source, and run the installer for your operating system (Windows, Mac, or Linux).
- Windows users should choose "Use Git from the Windows Command Prompt" during installation so Git works everywhere on your computer.
- After installation, open a terminal or command prompt and type git --version to confirm Git is working.
- If you use a graphical interface like GitHub Desktop or GitKraken, Git still needs to be installed on your computer first—those programs rely on it.
Installing Git on Windows
Go to git-scm.com and click the download button for Windows. This downloads a .exe file (usually named something like Git-2.x.x-64-bit.exe). Double-click it to start the installer.
The installer will ask you several questions. For most users, the defaults are fine, but one choice matters: when you see "Adjusting your PATH environment", select "Use Git from the Windows Command Prompt". This makes Git work when you open Command Prompt or PowerShell anywhere on your computer, rather than only in a special Git folder.
Click through the remaining screens and finish the installation. You do not need to launch Git when the installer finishes. Instead, open Command Prompt (search for "cmd" in the Windows start menu) and type git --version. If you see a version number, Git is installed and working.
Installing Git on Mac
Mac users have two main routes: the official installer or Homebrew (a package manager for Mac). The official installer is simpler if you have never used Homebrew before.
Visit git-scm.com and download the Mac installer. Open the .dmg file and run the Git installer inside it. Follow the prompts and finish the installation. Then open Terminal (search for "Terminal" in Spotlight) and type git --version to confirm it is working.
If you already use Homebrew, you can install Git by opening Terminal and typing brew install git. This is faster if you update Git regularly, because Homebrew handles updates automatically. Either method works equally well.
Installing Git on Linux
Linux distributions usually include a package manager that handles Git installation. The exact command depends on which distribution you use.
On Ubuntu or Debian, open a terminal and type sudo apt update followed by sudo apt install git. On Fedora, CentOS, or RHEL, use sudo dnf install git instead. On Arch, use sudo pacman -S git. Each command downloads and installs Git automatically.
After installation finishes, type git --version in the terminal to confirm it is working. If you see a version number, you are done.
Configuring Git after installation
Before you use Git to work with repositories, you should set your name and email address. Git records these with every change you make, so other people (and your future self) know who made each edit.
Open a terminal or command prompt and type these two commands, replacing the name and email with your own:
git config --global user.name "Your Name" git config --global user.email "your.email@example.com"
These settings are stored on your computer and apply to every repository you work with. You only need to do this once. If you ever want to change them, run the same commands with different information.
Using Git through a graphical interface instead of the command line
Some people prefer not to type commands and instead use a graphical application like GitHub Desktop, GitKraken, or Sourcetree. These programs have buttons and menus instead of a command line.
However, all of these graphical programs rely on Git being installed on your computer first. They are a layer on top of Git, not a replacement for it. So even if you plan to use GitHub Desktop, you still need to install Git using the steps above. After Git is installed, the graphical program can find it and use it automatically.
Troubleshooting: Git is not recognized as a command
If you type git --version and see an error like "git is not recognized" or "command not found", Git either did not install correctly or your computer does not know where to find it.
On Windows, restart your computer after installation. The PATH environment variable (which tells Windows where to look for programs) does not always update until you restart. After restarting, open a new Command Prompt window and try git --version again.
On Mac or Linux, make sure you ran the installer or package manager command completely and saw no error messages. If you installed Git but still see "command not found", try typing the full path: /usr/bin/git --version on Mac, or /usr/bin/git --version on Linux. If that works, Git is installed but your PATH needs adjustment—this is rare and usually only happens if you installed Git in an unusual location.
Frequently Asked Questions
Do I need to install Git if I only use GitHub's website?
No. You can create repositories, edit files, and manage code entirely through GitHub.com without installing Git. However, you cannot clone repositories to your computer or work offline without Git installed. Most developers install it because working locally on your own computer is faster and more flexible than using the website.
Can I have multiple versions of Git installed at the same time?
Technically yes, but it is not recommended. Having two versions can cause confusion about which one your commands are using. If you need a different version, uninstall the old one first, then install the new one.
What is the difference between Git and GitHub?
Git is the program you install on your computer that tracks changes to files. GitHub is a website where you can store and share repositories. You need Git to work with repositories locally; GitHub is optional and is just one place to store them online. Other sites like GitLab and Bitbucket offer similar services.
Do I need to pay for Git?
No. Git is free and open source. There are no paid versions or license fees. You download it, install it, and use it at no cost.
How do I update Git after I have installed it?
On Windows and Mac, download the latest installer from git-scm.com and run it—it will replace your old version. On Linux, use your package manager: sudo apt upgrade git on Ubuntu, or the equivalent command for your distribution. If you used Homebrew on Mac, type brew upgrade git.