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.
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.
- Press Windows key + R, type “appwiz.cpl“, and press Enter to open Programs and Features.
- Find Git, right-click it, and select Uninstall. Follow the instructions to remove Git.
- Restart your computer.
- Visit this link to download the latest Git version for Windows. If it doesn’t start automatically, select your OS bit version.
- Run the installer, keep default settings, and ensure to select Use Git from Windows Command Prompt.
- Proceed with the installation and click Install.
- 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.
- Press Windows key + R, type “sysdm.cpl“, and press Enter to open the System Properties menu.
- Go to the Advanced tab and click on Environment Variables.
- In the Environment Variables menu, under System variables, select Path, then click Edit.
- In the Edit environment variables window, click New and add C:\Program Files\Git\cmd. Press Enter.
- Click OK to save changes.
- Open a CMD window and type “git”.