我试图在Visual代码中插入GitBash作为选项。我的设置看起来是这样的:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"GitBash": {
"source": "GitBash",
"path": ["F:\\Code\\Git\\bin\\bash.exe"],
"icon": "terminal-bash"
}
},
"terminal.integrated.defaultProfile.windows": "GitBash"但是,在最后一行中,Visual代码给出的错误是:
Value is not accepted. Valid values: "PowerShell", "Command Prompt".(1)
The default profile used on Windows. This setting will currently be ignored if either #terminal.integrated.shell.windows# or #terminal.integrated.shellArgs.windows# are set.我不明白我哪里出了问题。
注:"terminal.integrated.shell.windows"于2021年4月被取消。
发布于 2021-06-21 13:26:58
我相信Visual代码使用您的路径变量来查找您的计算机上可用的配置文件。我猜您的路径中没有设置Git Bash的位置。但是,这应该可以,因为您在设置中指定了path属性。问题是您还在设置source属性。根据对terminal.integrated.profiles.windows设置的描述,可以设置source 或 path,而不是同时设置两者:
通过终端下拉菜单创建新终端时要呈现的Windows配置文件。设置为null以排除它们,使用
source属性使用默认检测到的配置。或,设置path和可选的args
删除source属性,查看问题是否得到解决,您可以在Visual代码中打开一个git终端。
此外,在进行这些更改后,可能需要重新启动Visual代码。这可能是一个单独的错误,但是terminal.integrated.profiles.windows设置在重新启动之前不会检测到添加的任何新配置文件。
发布于 2021-06-26 08:32:48
与代码版本1.57.1。
在env中添加了Git、Git\bin、Git\cmd的路径。有"Git Bash“配置文件的源和路径元素。移除源并只保留路径。当将defaultProfile添加为"Git“时,得到的"Value不被接受”错误。重新启动VS代码没有帮助。
将"Git Bash“改为"GitBash”(删除的空间)对我来说终于奏效了:
"terminal.integrated.profiles.windows": {
"GitBash": {
"path": ["D:\\ProgramFiles\\Git\\bin\\bash.exe"],
"args": []
},
...
}
"terminal.integrated.defaultProfile.windows": "GitBash"我不知道空间是否真的是问题所在。因为有一个配置文件“命令提示符”,它的名字和识别空间!为了进一步证实这一点,将"PowerShell“改为”PowerShell“,它也起了作用。
我不清楚空间是如何重要的,只有在"GitBash“简介中。
发布于 2021-09-28 20:10:41
对于在git安装中使用自定义dir的任何人:它不适用于版本: 1.60.2 (用户设置)
Win10用户:
{
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
},
"terminal.integrated.env.windows": {
},
"terminal.integrated.defaultProfile.windows": "Git Bash"
}https://stackoverflow.com/questions/68068359
复制相似问题