git is not recognized as an internal or external command, operable program or batch file is an external command error. It occurs while a user tries to run a ‘git’ command in CMD (Command Prompt). It appears because the user has not installed Git.
If you have already installed Git, it can also occur, but the command prompt was open while the user was installing git or the user did not set the path variable. There are different reasons behind appearing of this error.
Table of Contents
Reasons that can Cause the Error
- The user opened CMD (Command Prompt) window during installation.
- Git path is either not set or incorrect in system path variables.
How can we resolve this error?
Solution#01: Re-open command prompt
Solution#02: Set path in variables
- Set path during installation (An Automatic way).
- Set path manually in variables.
1. Set path during installation of git (An Automatic way):
Open downloaded .exe git file.
Follow the installation pattern; you can leave all other options to default. When you set your PATH environment, make sure you select the Git from Command Line toggle.
Set path manually in variables.
Step#01: Navigate to the Location of the 'Git' Folder that is inside of C:\Program Files
Step#02: Open CMD Folder Inside Git Folder
Step#03: Right-click on the git.exe File and Open Git Properties
Step#04: Select path and copy it
Step#05: Open System Properties and Go to Advanced System Settings
Step#06: Go to Environment Variables
Step#07: In the System Variables, Select the Path and Click on Edit or double-click path to set git installation path
Step#08: Paste the Copied Path
Click on New and paste the copied path to add correct git path and then, Click Ok
Click Ok on every opened window.
Step#09: Check if the Error has Resolved or Not?
Open CMD (Command Prompt) and run the git command and check if the error is resolved or not