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

The error ‘git’ is not recognized as an internal or external command happens when the system can’t find the Git program. This usually means Git isn’t installed, or its location isn’t added to the system’s PATH. This error indicates that the git command isn’t available in the terminal or command prompt.

'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.

The most common cause is not adding Git to the system’s PATH during installation. Also, if the command prompt was open during installation, it may need restarting to recognize Git.

In this article, we will discuss different ways to solve this error.

1. Re-Open Command Prompt

If you’ve installed Git but it’s not working in the command prompt, close and reopen it. The command prompt doesn’t update settings automatically while open, so reopening it loads the new Git path, making Git commands work.

2. Use the Git installation GUI to add the GIT path to Variables

Using the Git installation GUI to add Git to your system’s PATH allows Git commands to work in any terminal. Select “Use Git from the Windows Command Prompt” during installation to automatically set this up, avoiding manual setup and ensuring Git runs properly.

  1. Press Windows key + R, type “appwiz.cpl“, and press Enter to open Programs and Features.
  2. Find Git, right-click it, and select Uninstall. Follow the instructions to remove Git.
    Uninstall your current Git version
    Uninstall your current Git version
  3. Restart your computer.
  4. Visit this link to download the latest Git version for Windows. If it doesn’t start automatically, select your OS bit version.
    Downloading the Git installation executable
    Downloading the Git installation executable
  5. Run the installer, keep default settings, and ensure to select Use Git from Windows Command Prompt.
    Select Use Git from the Windows Command Prompt
    Select Use Git from the Windows Command Prompt
  6. Proceed with the installation and click Install.
    Installing Git for Windows
    Installing Git for Windows
  7. After installation, restart your computer to use Git commands in Windows Command Prompt.

3. Add the variable PATH manually

By Manually adding Git to the system’s PATH tells your computer where Git is installed, ensuring git commands work. This is needed if the PATH wasn’t set during installation or was removed. Add Git’s install folder to PATH, then restart the terminal to apply changes.

  1. Press Windows key + R, type “sysdm.cpl“, and press Enter to open the System Properties menu.
    Run dialog: sysdm.cpl
    Run dialog: sysdm.cpl
  2. 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
  3. In the Environment Variables menu, under System variables, select Path, then click Edit.
    Go to System Variables, select Path and click the Edit button
    Go to System Variables, select Path and click the Edit button
  4. In the Edit environment variables window, click New and add C:\Program Files\Git\cmd. Press Enter.
    Click on New and paste the git.exe's location
    Click on New and paste the git.exe’s location
  5. Click OK to save changes.
  6. Open a CMD window and type “git”.
    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.