VSCode 终端 + Git Bash“找不到命令"对于任何命令 [英] VSCode Terminal + Git Bash "command not found" for any command

查看:77
本文介绍了VSCode 终端 + Git Bash“找不到命令"对于任何命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My settings.json is very simple, it's replacing cmd.exe with sh.exe (from git).

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

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

Upon opening the shell, absolutely nothing works. I can't even ls.

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$

VSCode 是否不适用于 Mingw32(git 的 bash)?我如何设置它才能工作?

Does VSCode not work with Mingw32 (git's bash)? How do I set it up to work?

推荐答案

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

So git bash requires two arguments --login and separately -i

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

Thus the full json needs to look like:

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

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

This will cause all commands to work in the integrated terminal.

这篇关于VSCode 终端 + Git Bash“找不到命令"对于任何命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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