How to Fix: Git Is Not Recognized as an Internal or External Command Error
This article discusses three methods we can employ to fix the error 'git' is not recognized as an internal or external command
when using Git on the Command Prompt on Windows.
It is a commonly reported error by users who prefer running Git commands on the CMD instead of Git Bash. We got you if you are a Command Prompt fanatic struggling with this error.
Fix 'git' is not recognized as an internal or external command
Error
Before fixing an error or any problem, you must first identify the cause.
So, what causes the 'git' is not recognized as an internal or external command
error?
- The Git Path is not set or is incorrectly set in Variables.
- The Command Prompt was running during the installation of Git.
Here are three troubleshooting guides you can employ to fix this issue.
Re-Open Command Prompt
If you always have CMD running on your machine and install Git without closing the terminal, you will likely encounter this error. This issue occurs because your system has failed to update the Command Prompt with the latest Variable changes.
Closing and opening the Command Prompt should fix the issue. If the path is set correctly, you should be able to use Git on the CMD without encountering the error.
Automatically Add Git PATH
to Variables
This section is for those who do not want to mess up their PATH
variables.
You can use the Git GUI to automatically create and add the path for you. You will have to uninstall and install Git again.
Follow these steps to fix the 'git' is not recognized as an internal or external command
error.
-
Use the Windows+R to open the
Run
dialog box. To openPrograms and Features
, type"appwiz.cl"
and hit Enter. -
In the
Programs and Features
tab, locate your Git entry, right-click on it and selectUninstall
to remove Git from your machine. -
Once done, download the latest Git executable file or use the one you had previously used to install Git on your machine.
-
Follow the prompts and leave everything to default. Once you get to the
Adjusting your PATH environment
tab, select the second option, as shown below. -
Finish the installation process.
This should fix the error. You should be able to use Git commands on the Command Prompt.
Manually Add Git PATH
to Variables
If the Git variable is not configured or incorrectly configured in the Environment Variables
, you will have issues working with Git commands on the Command Prompt.
To manually configure the path, follow these steps.
-
Navigate to the Git installation folder on your computer. Here are the common installation paths depending on your system’s architecture.
For
x86
versions:My Computer (This PC) > Local Disk(C:) > Program Files (x86) > Git > cmd
For
x64
versions:My Computer (This PC) > Local Disk(C:) > Program Files > Git > cmd
-
Open the
Properties
tab for the Git executable file and copy theLocation
path. -
Open the
Run
dialog box, typesysdm.cpl
and hit Enter to theSystem Properties
window. SelectEnvironment Variables
in theAdvanced
tab. -
On the
System Variables
submenu, click onPath
and hitEdit
. -
Select
New
on theEdit Environment Variables
tab and paste the location we had copied in step two. -
Click
OK
to save the changes and launch your Command Prompt.You should be able to use Git commands on the Command Prompt without issues.
In summary, if you are getting the 'git' is not recognized as an internal or external command
error while using Git commands on the Command Prompt, you will need to set the Git PATH
variable. As we discussed, there are two ways of doing this.
John is a Git and PowerShell geek. He uses his expertise in the version control system to help businesses manage their source code. According to him, Shell scripting is the number one choice for automating the management of systems.
LinkedInRelated Article - Git Error
- How to Resolve Git Status Unmerged Paths
- Bower: ENOGIT Git Is Not Installed or Not in the PATH
- How to Fix Another Git Process Seems to Be Running in This Repository Error
- How to Fix Fatal: Origin Does Not Appear to Be a Git Repository Error in Git
- How to Fix Fatal: The Current Branch Master Has No Upstream Branch Error in Git