[windows] 'git' is not recognized as an internal or external command

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?

This question is related to windows git path environment-variables command-prompt

The answer is


If you want to setup for temporary purpose, just execute below command.

  1. open command prompt < run --> cmd >
  2. Run below command.
    set PATH=C:\Program Files\Git\bin;%PATH%
  3. Type git, it will work.

This is valid for current window/cell only, if you will close command prompt, everything will get vanish. For permanently setting, set GIT in environment variable.

a. press Window+Pause
b. click on Advance system setting.

c. Click on Environment variable under Advance Tab.

d. Edit Path Variable.

e. Add below line in end of statement.
;c:\Program Files\Git\bin;

f. Press OK!!
g. Open new command prompt .
h. Type git and press Enter

Thanks


If you get this error, you might not have git installed in your system.

Download it here:

https://git-scm.com/downloads

Install it.

If you have Windows, you will now see a C:\Program Files\Git folder.

Open a new Command Prompt window, and try running the git command again.


That's because at the time of installation you have selected the default radio button to use "Git" with the "Git bash" only. If you would have chosen "Git and command line tool" than this would not be an issue.

  • Solution#1: as you have already installed Git tool, now navigate to the desired folder and then right click and use "Git bash here" to run your same command and it will run properly.
  • Solution#2: try installing again the Git-scm and select the proper choice.

  • Make sure correct git path is added to Path variable in your Environment Variables. E.g. - C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd. It can be different for your case depending on where your git gets installed.
  • If it doesnt work, try restarting the command prompt so that it reads the updated Environment Variables.
  • If it still doesnt work, try restarting your machine to force command prompt to read the updated Environment variables.

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


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.


Yo! I had lots of problems with this. It seems that Github brings its own console which you need to look for in your drive. I managed to finally run it by doing the following:

  1. Press Start.
  2. Search for "GitHub" (without quotes)
  3. Right click on "GitHub" and select "Open File Location"

*This shall open *

C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\GitHub, Inc

Where username is your PC's username

  1. Look for a program called "Git Shell". Double click on it.

This will open a PowerShell command prompt. Then you can run your git commands normally on it.


Just wanted to add to Abizern answer. If anyone is using a non-administrator account, you can create a "local" variable instead of a "system" variable which allows access to standard/limited accounts.

When on the "Environmental Variables" window:

1) Select "New..." button within the "User variables for ..." section.

2) Set the "Variable name:" as "path" and "Variable value:" as "[your-git-path]" (usually found at C:\Program Files (x86)\Git\bin).

3) Then click OK.


I had this problem,when you install the git,you have to choose the right path,i mean,it should be the same path that you write git(code)in the Git Bash...for example,if your path is c:\Users\username , you must install the git in same path(c:\Users\username)..these 2 paths should not be different


  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

If you're using Windows 10, do this:

  1. Go to Start

  2. Start typing 'This PC'

  3. Right-click This PC, choose Properties

  4. On the left side of the window that pops up, click on Advanced System Settings

  5. Click on the Advanced tab

  6. Click on the Environmental Variables button at the bottom

  7. Down in the System Variables section, double-click Path

  8. Click the New button in the top right corner

  9. Add this path: C:\Program Files\Git\bin\ then click the enter key

  10. Add another path: C:\Program Files\Git\cmd

  11. Close & re-open the console if it's already open.

I stepped you through the long way so you gain exposure to the different Windows/menus. Good luck.


Windows 7 32 - bit

I am using git for my Ruby on Rails application. First time so...

I created a .bat file for loading my RoR applications with the paths manually typed using this tutorial at "http://www.youtube.com/watch?v=-eFwV8lRu1w" If you are new to Ruby on Rails you might want to check it out as I followed all steps and it works flawlessly after a few trials and errors.

(The .bat file is editable using notepad++ hence no need for the long process whenever you need to edit a path, you can follow these simple process after creating a .bat file following the tutorials on the link above "file is called row.bat".)

  1. right click on the .bat file,
  2. edit with notepad++.
  3. find path.
  4. insert path below the last path you inputted.

    )
    During the tutorials I don't remember anything said in regards to using the git command so when starting a new project I had this same problem after installing git. The main issue I had was locating the folder with the bin/git.exe (git.exe did not show up in search using start menu's "search programs and files" ) NOTE I now understood that the location might vary drastically --- see below.

To locate the bin/git.exe i followed this steps

1 left click start menu and locate ->> all programs ->> GitHub inc. 2 right click git shell and select open file location 3 click through folders in the file location for the folder "bin"

(I had 4 folders named 1. IgnoreTemplates_fdbf2020839cde135ff9dbed7d503f8e03fa3ab4 2. lfs-x86_0.5.1 3. PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad ("bin/exe, found here <<-") 4. PoshGit_869d4c5159797755bc04749db47b166136e59132 )

Copy the full link by clicking on the explorers url (mine was "C:\Users\username\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\bin") open .bat file in notepad++ and paste using instructions on how to add a path to your .bat file from tutorials above. Problem solved!


Just check whether the Bit Locker has enabled!. I faced a similar issue where my GIT in the cmd was working fine. But after a quick restart, it didn't work and I got the error as mentioned above.

So I had to unlock the Bit locker since I have installed GIT in the Hard drive volume (:E) which was encrypted by Bit Locker.


;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd

add above path in environment variables

note: path may differ but you should add both bin and cmd


Start->All Programs->Git->Git Bash

Takes you directly to the Git Shell.


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


This helps for me : I set C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd in path for environment variable.


After installation, open the GitHub app and on the top right corner you'd notice a setting icon. Select Options from the dropdown and choose "Default Shell" as Cmd.

Now try typing 'git shell' in the search (windows key and type) and choose Git Shell. It should open up in CMD and git should now be recognized.


  1. Search for GitHubDesktop\app-2.5.0\resources\app\git\cmd
  2. Open the File
  3. Copy File location.
  4. Search for environment.
  5. open edit system environment variable.
  6. open Environment Variables.
  7. on user variable double-click on Path.
  8. click on new
  9. past
  10. OK
  11. Open path on system variables.
  12. New, past the add \ (backslash), then OK
  13. Search for GitHubDesktop\app-2.5.0\resources\app\git\usr\bin\ 14 Copy the Address again and repeat pasting from step 4 to 12.

Examples related to windows

"Permission Denied" trying to run Python on Windows 10 A fatal error occurred while creating a TLS client credential. The internal error state is 10013 How to install OpenJDK 11 on Windows? I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."? git clone: Authentication failed for <URL> How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning" XCOPY: Overwrite all without prompt in BATCH Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory how to open Jupyter notebook in chrome on windows Tensorflow import error: No module named 'tensorflow'

Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to path

Get Path from another app (WhatsApp) How to serve up images in Angular2? How to create multiple output paths in Webpack config Setting the correct PATH for Eclipse How to change the Jupyter start-up folder Setting up enviromental variables in Windows 10 to use java and javac How do I edit $PATH (.bash_profile) on OSX? Can't find SDK folder inside Android studio path, and SDK manager not opening Get the directory from a file path in java (android) Graphviz's executables are not found (Python 3.4)

Examples related to environment-variables

Using Environment Variables with Vue.js Adding an .env file to React Project Is there any way to set environment variables in Visual Studio Code? Test process.env with Jest How to set environment variables in PyCharm? ARG or ENV, which one to use in this case? how to set ASPNETCORE_ENVIRONMENT to be considered for publishing an asp.net core application? What is a good practice to check if an environmental variable exists or not? Passing bash variable to jq Tensorflow set CUDA_VISIBLE_DEVICES within jupyter

Examples related to command-prompt

CMD command to check connected USB devices How do I kill the process currently using a port on localhost in Windows? PowerShell The term is not recognized as cmdlet function script file or operable program open program minimized via command prompt How to connect to SQL Server from command prompt with Windows authentication How to see the proxy settings on windows? How do I type a TAB character in PowerShell? Batch file to split .csv file Aliases in Windows command prompt Change all files and folders permissions of a directory to 644/755