Fix: ‘git’ is not recognized as an internal or external command

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.

'git' is not recognized as an internal or external command, operable program or batch file.
‘git’ is not recognized as an internal or external command,
operable program or batch file.

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:

  1. 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.
    Run dialog: appwiz.cpl
    Run dialog: appwiz.cpl
  2. 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.
    Uninstall your current Git version
    Uninstall your current Git version
  3. Restart your computer to complete the uninstallation process.
  4. 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.
    Downloading the Git installation executable
    Downloading the Git installation executable
  5. 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.
    Select Use Git from the Windows Command Prompt
    Select Use Git from the Windows Command Prompt
  6. Continue the installation configuration by leaving the default selected values (or select your own), then click the Install button.
    Installing Git for Windows
    Installing Git for Windows
  7. 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:

  1. 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
  2. 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).
    Copy the location of git.exe
    Copy the location of git.exe
  3. 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.
    Run dialog: sysdm.cpl
    Run dialog: sysdm.cpl
  4. Inside the System Properties menu, go to the Advanced tab and click on Environment Variables.
    go to the Advanced tab and click on Environment Variables
    Go to the Advanced tab and click on Environment Variables
  5. Inside the Environment Variables menu, go to the System variables submenu, select Path, then click the Edit button.
    Go to System Variables, select Path and click the Edit button
    Go to System Variables, select Path and click the Edit button
  6. 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 on New and paste the git.exe's location
    Click on New and paste the git.exe’s location
  7. Click OK on every opened prompt to ensure that the change is saved.
  8. Open a CMD window and type “git”. You should no longer encounter the “git’ is not recognized as an internal or external command” error.
    Git error is now resolved
    Git terminal error is now resolved
ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.