Several users report getting the “git’ is not recognized as an internal or external command” error when trying to run a git command in Command Prompt. While some users reported that this issue has occurred sometime after they installed Git for Windows, others face this issue as soon as the Git installation is complete.
What is causing the ‘git’ is not recognized as an internal or external command error
We investigated this particular issue by looking at various user reports. Based on our investigations, there are several scenarios why this error occurs:
- Git PATH is not (or incorrectly) set in Variables – A recent software in the software itself or a user mistake might have incorrectly configured the Git PATH in the variables bracket.
- CMD was opened during the installation of GIT – If you recently installed Git for Windows while a Command Prompt window was opened, the issue might be resolved as soon as you re-open Command Prompt.
If you’re struggling to resolve this particular issue, this article will provide you with some troubleshooting guides. Below you have a collection of methods that other users in a similar situation have used to get the issue resolved. For the best results, follow the methods in order until you find a fix that is effective in resolving the issue in your particular situation.
Method 1: Re-open Command Prompt
If you’re terminal kind of guy (or girl) and you keep a CMD window opened at all times (even during the installation of Git), the issue might occur because Command Prompt wasn’t updated with the latest Variables changes.
If this scenario is applicable to you, the fix is as simple as closing the CMD window and opening another one. If the path was set correctly, you will be able to use Git commands without receiving the “git’ is not recognized as an internal or external command” error.
If this scenario is not applicable to your situation, move down to the next method below.
Method 2: Using the Automatic way of adding GIT path to Variables
If you want to stay away from messing with PATH variables, you can resolve the “git’ is not recognized as an internal or external command” error by using the Git installation GUI to automatically create the Path variables for you. Doing this will enable you to use Git from both Git Bash and from Windows Command Prompt.
Here’s a quick guide on uninstalling Git and then configuring the initial installation to automatically add the path variables for you:
- Press Windows key + R to open up a Run dialog box. Then, type “appwiz.cpl” and press Enter to open up the Programs and Features window.
- Inside Programs and Features, look for a Git entry, right-click on it and click Uninstall. Then, follow the on-screen prompts to remove the current installation of Git.
- Restart your computer to complete the uninstallation process.
- Visit this link (here) and download the latest version of Git for Windows. The download should start automatically. If it doesn’t, simply click on the version associated with your OS bit architecture.
- Open the installation executable and follow on with the installation prompts. You can leave all the options to the default values. When you get to the Adjusting your PATH environment, make sure you select the Use Git from Windows Command Prompt toggle.
- Continue the installation configuration by leaving the default selected values (or select your own), then click the Install button.
- Once the installation is complete, restart your computer. At the next startup, you will be able to run commands directly from Windows Command Prompt.
If you’re looking for a method that will resolve the issue without having to uninstall the Git client, move down to the next method below.
Method 3: Adding the variable PATH manually
If you’ve come this far without a result, it is very likely that you’re seeing this particular issue because the Git variable is not configured (or improperly configured) in the Environment Variables.
Luckily, you can configure the Variable value manually by following a set of instructions. Here’s what you need to do:
- Open File Explorer and navigate to the location of the cmd folder inside the Git installation. Here are the default paths for x86 and x64 versions:
My Computer (This PC) > Local Disk(C:) > Program Files (x86) > Git > cmd My Computer (This PC) > Local Disk(C:) > Program Files > Git > cmd
- Next, right-click on git.exe and choose Properties. Then, in the General tab of git.exe Properties, copy the location of the executable (we’ll need it later).
- Next, press Windows key + R to open up a Run dialog box, then type “sysdm.cpl” and press Enter to open the System Properties menu.
- Inside the System Properties menu, go to the Advanced tab and click on Environment Variables.
- Inside the Environment Variables menu, go to the System variables submenu, select Path, then click the Edit button.
- In the Edit environment variables window, click the New button and simply paste the location that we copied at step 2. Then, hit Enter to create the variable.
- Click OK on every opened prompt to ensure that the change is saved.
- Open a CMD window and type “git”. You should no longer encounter the “git’ is not recognized as an internal or external command” error.