VSCode终端+ Git Bash"命令未找到"任何命令

Flu*_*lux 4 visual-studio-code vscode-settings

我的settings.json很简单,它用sh.exe替换cmd.exe(来自git).

{
    "terminal.integrated.shell.windows": "C:\\Program Files (x86)\\Git\\bin\\sh.exe"
}
Run Code Online (Sandbox Code Playgroud)

打开外壳后,绝对没有任何作用.我甚至不能.

sh.exe"-3.1$ ls
sh.exe": ls: command not found
sh.exe"-3.1$ cd ..
sh.exe"-3.1$ ls
sh.exe": ls: command not found
sh.exe"-3.1$
Run Code Online (Sandbox Code Playgroud)

VSCode不适用于Mingw32(git的bash)吗?如何设置它?

Flu*_*lux 13

所以git bash需要两个参数--login和单独的-i

因此,完整的json需要看起来像:

{
    "terminal.integrated.shell.windows": "C:\\Program Files (x86)\\Git\\bin\\bash.exe",
    "terminal.integrated.shellArgs.windows": ["--login","-i"]
}
Run Code Online (Sandbox Code Playgroud)

这将导致所有命令在集成终端中工作.