Search code examples
gitpathenvironment-variablesdevelopment-environment

Install git in Windows 10


I have installed git in my pc (Windows 10) and set the environment variable path also.

But upon downloading WPCS using git git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs, I get the following error

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

The Git directory path is C:\Program Files\Git and I have set the environment variable as C:\Program Files\Git\cmd.

Can anyone suggest me what might be the problem here?

I have tried these commands also

enter image description here


Solution

  • It's surely a problem of environment variable refresh (accepting that you selected the good option to update the PATH in the installer).

    Environment variables (and, so the PATH) of a process (here cmd.exe) are inherited from the ones of the parent process at the creation of the process.

    When the env var is rightly set, restarting the computer is a solution that always works.

    You could also, as a workaround, open the task manager and kill and restart all the explorer.exe process to force the refresh of env variables.

    And then all the new processes created from him will have the good refreshed values. That should work (depending on how you open you command prompt ;) )