How To Resolve Error "Git is not recognized" on Windows?
Last Updated :
29 Aug, 2024
The "Git is not recognized as an internal or external command" error is a common issue faced by Windows users when trying to run Git commands from the Command Prompt or PowerShell. This error occurs because Git is not added to the system’s PATH environment variable, which is necessary for the operating system to locate the Git executable. In this article, we'll explore several methods to resolve this error.
Common Causes:
- Git is not installed.
- The Git installation path is not added to the system’s PATH environment variable.
- Incorrect or incomplete installation of Git.
There are several ways to resolve the "git is not recognized" error:
Approach 1: Check if Git is Installed
First, verify whether Git is installed on your system:
Step 1: Open Command Prompt or PowerShell.
Step 2: Type git --version and press Enter.
Expected Output:
If Git is installed, you should see a version number like:
git version 2.40.0.windows.1
git --version
If you see the error "git is not recognized", Git is either not installed or not configured correctly.
Approach 2: Add Git to the System’s PATH Manually
If Git is installed but not recognized, you need to manually add its installation path to the PATH environment variable.
Step 1: Find the Git Installation Path:
By default, Git is installed in a directory like:
C:\Program Files\Git\bin
You can check this path by navigating to where Git was installed.
Step 2: Add the Path to the Environment Variable:
- Right-click on This PC or My Computer and select Properties.
- Click Advanced system settings on the left.
- In the System Properties window, click the Environment Variables button.
- In the Environment Variables window, find the Path variable under System variables and select Edit.
- Click New and add the Git installation path (e.g., C:\Program Files\Git\bin).
PATH6. Click OK to save the changes.
Environment Variables
Verify the PATH:
Open Command Prompt again and type git --version. If everything is set correctly, you should see the Git version information instead of the error.
Approach 3: Reinstall Git and Select the PATH Option
If adding Git to the PATH manually doesn’t work, reinstall Git with the correct settings:
- Download the latest version of Git from the official website.
- Run the installer and follow the steps.
- During the installation process, when you reach the step that says Adjusting your PATH environment, select the option Use Git from the command line and also from 3rd-party software.
- Complete the installation.
- Open Command Prompt and type git --version to verify the installation.
Approach 4: Verify the PATH is Correct
Sometimes the PATH variable may have an incorrect or incomplete Git path. To verify:
- Follow the same steps as in approach 2 to open the Environment Variables window.
- In the Path variable, check if the Git path is correct and points to the bin or cmd directory inside the Git installation folder.
- If the path is incorrect, correct it by clicking Edit and providing the accurate path.
Similar Reads
How to Install Sourcetree for GIT in Windows? Sourcetree is designed to simplify the Interaction with Git repositories which require command lines to work. It is a free GUI(Graphic user interface) that reduces the workload of a user by making it easier to remove a file, discard a file, or commit a file as it manages and visualizes the work live
2 min read
How to Install Git on Windows Subsystem for Linux? Git is an open-source distributed version control system developed to handle everything from simple to complex projects with performance and speed. Git software allows a team or group of developers to work together, with all using the same files and folders. It gradually reduces the confusion that t
2 min read
How To Resolve "not something we can merge" error in Git? The "not something we can merge" error in Git usually indicates that Git is unable to identify a valid branch, commit, or reference to merge. This can occur due to various reasons, such as typos in branch names, non-existent references, or issues with the repository's state. This article will guide
3 min read
How to Install GIT-TFS on Windows? GIT-TFS is a tool that allows you to interact with TFS (Team Foundation Server) and enables the use of Git as a client for Microsoft TFS. Using Git commands, it provides a way to access TFS version control, allowing developers to use features to interact with TFS. GIT-TFS provides many features such
2 min read
How to Install Git on Windows Git is a powerful version control system used by developers worldwide. If you're looking to set up Git on your Windows machine, you have several options. This article will walk you through the most reliable and effective methods for installing Git on Windows, ensuring you stay up to date with the la
5 min read