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.

Comments

10
    KM
    kml Aug 31, 2020

    dear very very very very much thanxxxxxx to you for this help

    SB
    Single Byte Sep 2, 2020

    Cheers up for the person who wrote this post. Love u man.

    SA
    sagar Sep 30, 2020

    You are gem. Keep shining bro.

    RL
    Roast Dinners London Jan 31, 2021

    Yep – great post – solved my problem.

    LY
    Luthfi Arifandi Yk Sep 18, 2021

    NICEEEEEEEEEEEE

      ME
      Maedu Ekpenyong Oct 15, 2021

      kindly help out please. i can’t find the git.exe file on my program files folder.

        MZ
        Muhammad Zubyan Author Oct 17, 2021

        Try Method 2, install Git again.

    ME
    Maedu Ekpenyong Oct 18, 2021

    I tried adding the variable path manually, [git.exe] file doesn’t exist on my folder. Below is a screenshot… https://uploads.disquscdn.c

      MZ
      Muhammad Zubyan Author Oct 18, 2021

      The file named “git” the file that is on the top is basically “git.exe”. You have to unhide the extensions to check that it is an executable file here: https://appuals.com/how-to-

    NI
    Nico Feb 3, 2023

    Thanks much Kevin. The best!