user13651330
user13651330

Reputation:

Error "'git' is not recognized as the name of a cmdlet"

I'm trying to clone a project of GitHub into Visual Studio, so I go to New Terminal and type:

git clone [CLONE WITH SSH LINK]

and it shows:

git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

However, I have already installed Git and Git is set to Enabled at Visual Studio settings.

Why does this error occur, and how can I fix it?

And how can I set/change the path of Git in Visual Studio...

Upvotes: 13

Views: 83716

Answers (6)

Swapna
Swapna

Reputation: 1

After Opening a new folder in Visual Studio Code select gitbash option that is present under powershell option in right corner and then use the terminal. ☺️☺️

Upvotes: 0

levis Noor
levis Noor

Reputation: 11

You will need to add the bin and cmd file paths for the GIT program file in the environment variable. Find the environment variable by searching in your computer to add the file paths. Afterwards just restart your terminal.

Upvotes: 0

mirage
mirage

Reputation: 57

BRIEF: Run your editor, such as vim or vscode, with Administrator privileges (after installing git from git-scm.com).

Error "'git' is not recognized as the name of a cmdlet"

Upvotes: -1

Leosanab
Leosanab

Reputation: 1

I just reopened Visual Studio right after installing Git and that solved the issue for me! Just make sure to make it default for Visual Studio and allow third party command prompt.

Upvotes: 0

Mohammed Shakeeb
Mohammed Shakeeb

Reputation: 91

The reason behind it is that you might have not added the Path environment variable. So here are the steps for that.

Go to Environment Variable. Click on to the Path variable, Edit and add it to the path given below:

C:\Program Files\Git\bin

C:\Program Files\Git\cmd

Click OK and close your terminal. Now open the terminal and check the command. You're looking for e.g. git --version. It gives you the version you have installed.

Upvotes: 9

SystemX
SystemX

Reputation: 539

Reinstall Git and reopen the editor

I solved the same problem by reinstalling Git.

And refreshed npm.

Then I closed the editor and reopened it.

Upvotes: 9

Related Questions