Search code examples
gitgithubgithub-for-windows

Error: git is not recognized as the name of cmdlet


I installed git according to windows comptability but still not working: enter image description here

the solution I tried:

I tried changing the path variable in system variables but it's not available to edit:

enter image description here


Solution

  • The issue is related to PATH Variables:

    Check the PATH variable:

    Git needs to be included in your system's PATH variable so that you can run it from the command prompt or PowerShell, it is included when you the git installer in Windows, you can verify that using following steps:

    • Open the Start menu and search for "Environment Variables."
    • Select "Edit the system environment variables."
    • In the System Properties window, click the "Environment Variables" button.
    • Under "System variables," find and select the "Path" variable, Check for git PATH Variables.
    • If not available there then click the "Edit" button.
    • Click the "New" button, and then add the directory where Git is installed. By default, it's often in "C:\Program Files\Git\bin" or "C:\Program Files\Git\cmd."
    • Click OK to save the changes and close the windows.

    Restart your command prompt or VS Code Terminal:

    After making changes to the PATH variable, it's a good practice to close and reopen your command prompt or terminal to ensure that the changes take effect.

    Verify Git installation:

    To confirm that Git is installed and configured correctly, open your command prompt or VS Code terminal and type:

    git --version

    This command should display the installed Git version, which indicates that Git is now recognized.

    Git Path Variable