'git' is not recognized as an internal or external command

1,211,829

Solution 1

Have you correctly set your PATH to point at your Git installation?

You need to add the following paths to PATH:

  • C:\Program Files\Git\bin\
  • C:\Program Files\Git\cmd\

And check that these paths are correct – you may have Git installed on a different drive, or under Program Files (x86). Correct the paths if necessary.


Modifying PATH on Windows 10:

  1. In the Start Menu or taskbar search, search for "environment variable".
  2. Select "Edit the system environment variables".
  3. Click the "Environment Variables" button at the bottom.
  4. Double-click the "Path" entry under "System variables".
  5. With the "New" button in the PATH editor, add C:\Program Files\Git\bin\ and C:\Program Files\Git\cmd\ to the end of the list.
  6. Close and re-open your console.

Modifying PATH on Windows 7:

  1. Right-click "Computer" on the Desktop or Start Menu.
  2. Select "Properties".
  3. On the very far left, click the "Advanced system settings" link.
  4. Click the "Environment Variables" button at the bottom.
  5. Double-click the "Path" entry under "System variables".
  6. At the end of "Variable value", insert a ; if there is not already one, and then C:\Program Files\Git\bin\;C:\Program Files\Git\cmd\. Do not put a space between ; and the entry.
  7. Close and re-open your console.

If these instructions weren't helpful, feel free to look at some others:

Solution 2

Did you open the cmd prompt before installation of git? If so, close and reopen it.

Solution 3

  1. Go to My Computer => Local Disk(C:) => Program Files(x86) => Git => cmd
  2. Right Click the git => Select Properties
  3. Under the location Copy the text eg - C:\Program Files (x86)\Git\cmd
  4. Come back to the Desktop
  5. Right-click My Computer
  6. Select property
  7. Open Advanced
  8. Click Environment Variables
  9. In the System variables Find the Variable call Path
  10. Click the variable
  11. Click the Edit Button
  12. Select the Variable value Text Box .
  13. Go to the edge of the text and put semicolon(;)
  14. Then Right-click and press Paste
  15. Press Ok

Solution 4

If you are using GitHub for Windows (GitHub's old Git GUI that is no longer available for download, not the new Electron-based GitHub Desktop), you have an installation of Git under:

C:\Users\<YOUR USERNAME>\AppData\Local\GitHub\PortableGit_8810fd5c2c79c73adcc73fd0825f3b32fdb816e7\cmd

Expand this path, and add it to PATH.

Solution 5

Easy route to avoid messing with PATH variables: re-install git and select "Use Git from the Windows Command Prompt". It'll take of the PATH variables for you as mentioned. see screenshot

enter image description here

Share:
1,211,829
Jason Kim
Author by

Jason Kim

Author of Just Enough Ruby to Get By Follow me @jasoki

Updated on October 01, 2021

Comments

  • Jason Kim
    Jason Kim over 2 years

    I have an installation of Git for Windows, but when I try to use the git command in Command Prompt, I get the following error:

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

    How do I fix this problem?