尝试在 vscode powershell 终端中使用命令 git init 但出现错误:git:术语“git"未被识别为 cmdlet 的名称 [英] Trying to use the command git init within vscode powershell terminal but get an error: git : The term 'git' is not recognized as the name of a cmdlet

查看:59
本文介绍了尝试在 vscode powershell 终端中使用命令 git init 但出现错误:git:术语“git"未被识别为 cmdlet 的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用命令 git init.但是,我收到此错误:

I'm trying to use the command git init. However, I'm getting this error:

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.
At line:1 char:1
+ git init
+ ~~~
    + CategoryInfo          : ObjectNotFound: (git:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

不确定是否与项目文件夹和 git 可执行文件的位置不同有关,但信息如下:

Not sure if it's related to the difference in the locations of the project folder and the git executable but here's the info:

我正在工作的文件夹的位置是:

The location of the folder in which I'm working is:

S:\Everything\Coding\modern_portofolio

git安装位置为:

S:\Everything\Software\Git

推荐答案

尝试从已正确设置 PATH 的 CMD 会话启动您的 VSCode.

Try and launch your VSCode from a CMD session where your PATH was correctly setup.

set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

然后 git 命令应该可以从 VSCode 控制台中识别出来,无论是 PowerShell 还是其他.

Then the git command should be recognized from within VSCode console, be it a PowerShell one or any other.

这篇关于尝试在 vscode powershell 终端中使用命令 git init 但出现错误:git:术语“git"未被识别为 cmdlet 的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆