How to resolve the error "git is not recognized" on windows

Greg Foster
Greg Foster
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


Encountering the error "git is not recognized" or "git command not found" typically indicates that Git is either not installed on your system or its installation path is not included in the system's PATH environment variable. This guide will help you troubleshoot and resolve these issues, ensuring that Git commands operate smoothly in your terminal or command prompt.

The first step is to check whether Git is installed on your Windows machine.

  • Open the command prompt or PowerShell and run:

    git --version

  • If Git is installed, you should see a version number as output.

screenshot of git version output

  • If you see an error like "git is not recognized as an internal or external command proceed to the next steps.
Join 20,000+ developers at top companies
Stop wrestling with Git commands
The Graphite CLI takes all the pain out of Git, allowing you to ship faster and stop googling Git commands.
main
diff1
diff2

If Git is not installed, you'll need to download and install it.

  • Download git: Visit the official Git website to download the latest version of Git for Windows.

  • Run the installer: Execute the downloaded file and follow the installation prompts. Default options are typically sufficient for most users.

  • Verify installation: Reopen the Command Prompt or PowerShell and type git --version to confirm Git is now recognized.

While Git is an incredibly useful tool, it has many shortcomings, particularly with rebasing, and managing stacked pull requests.

The Graphite CLI simplifies git, handles rebasing automatically, and allows you to create, submit, and stack pull requests right from the command line.

Under the hood, the CLI runs Git to create branches, commits, and metadata, which means you can still use Git in your scripts, tooling, or whenever you feel like it. Read more about installing the Graphite CLI in our docs.

screenshot of the Graphite CLI

If Git is installed but not recognized, it's likely not added to the PATH environment variable. Adding Git to the PATH allows the system to locate the Git executable from any command line interface.

  • Find git installation path: The default installation path is usually C:\Program Files\Git\cmd. Verify this location exists or find where Git is installed on your machine.

  • Edit system PATH:

    • Open the Start Menu Search, type in env, and choose "Edit the system environment variables".

    • In the System Properties window, click on "Environment Variables".

    • Under "System variables", scroll to find the "Path" variable and select it, then click "Edit".

    • Click "New" and paste the path to your Git cmd folder (e.g., C:\Program Files\Git\cmd).

    • Click "OK" to close all dialogs and apply these changes.

  • Verify the change: Close and reopen your Command Prompt or PowerShell and type git --version to ensure Git is now recognized.

Sometimes, the issue might be as simple as a typo in the Git command you're trying to execute. Ensure you're typing the command correctly, such as git clone instead of incorrectly spelled variations like gti clone.

Join 20,000+ developers at top companies
The best engineers use Graphite to simplify Git
Engineers at Vercel, Snowflake & The Browser Company are shipping faster and staying unblocked with Graphite.
main
diff1
diff2

If you continue to experience issues in the Command Prompt or PowerShell, consider using Git Bash, which is installed alongside Git for Windows. Git Bash provides a Unix-like terminal where Git commands should work without additional configuration.

screenshot of Git For Windows

  • Find and open Git Bash: Locate Git Bash in your Start Menu or use the search function to find it.

  • Try Your Git command: Use Git Bash to run the Git command that was previously not recognized.

As a last resort, if Git still isn't recognized, there might have been an issue with the initial installation.

  • Uninstall Git: Go to "Control Panel" > "Programs and Features", find Git in the list, and uninstall it.

  • Reinstall Git: Download the latest version of Git for Windows and follow the installation process again, making sure to add Git to the PATH during installation.

For further reading check out the official Git For Windows documentation.

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2