Search code examples
gitpowershellvisual-studio-codepath-variables

Powershell Doesn't Identify Git Commands Even With Environment Variable


My Power Shell does not recognize the "git" command at all even after I have reinstalled my Windows 10 after deleting my environment variable and not even after I have reinstalled Git. The environment variable path that Git uses is C:\Program Files\Git\cmd. I don't know if it has anything to do with it. Power Shell says it doesn't recognize "git" as a cmdlet, function, script file, or operable program.

I already tried to check if there was a similar problem on the internet, but the proposed solutions did not help me.


Solution

  • I get the same error when I type in what you did on my Powershell, even though my git command works. Have you tried entering this command? This works for me since it directly calls the git application within the cmd directory.

    & 'C:\Program Files\Git\cmd\git'
    

    For others on the Internet, the ampersand & is to let Powershell know that the inside of the string is the command you want to run, which is helpful for computer commands where there may be a space in a directory name.