a_g*_*irl 7 windows git-bash windows-10 visual-studio-code
我尝试将 Git Bash 设置为 VSCode 中的默认终端,但无法成功。我已经尝试遵循下一篇文章:
但他们还没有解决我的问题。
我设法在 中生成配置文件settings.json,但 Git Bash 由于某种我未知的原因无法工作,并且 VsCode 显示错误。
我的settings.json:
{
"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"
},
"Git Bash": {
"source": "Git Bash",
"path": "C:\\git-sdk-64\\git-bash.exe",
"args": [
"--login",
"-i"
]
},
"Cygwin": {
"path": "C:\\cygwin64\\bin\\bash.exe",
"args": [
"--login"
]
}
},
"terminal.integrated.defaultProfile.windows": "Git Bash"
}
Run Code Online (Sandbox Code Playgroud)
错误:
有谁知道如何解决这一问题?
我的 VsCode 版本:
Version: 1.57.1 (user setup)
Commit: 507ce72a4466fbb27b715c3722558bb15afa9f48
Date: 2021-06-17T13:28:07.755Z
Electron: 12.0.7
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.19042
Run Code Online (Sandbox Code Playgroud)
我使用git SDK,它类似于 git-bash 但不完全一样。也许这就是问题所在?
小智 6
这终于对我有用了
"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": {
"path": ["C:\\Program Files\\Git\\bin\\bash.exe"],
"args": [],
"icon": "terminal-bash"
}
},
"terminal.integrated.defaultProfile.windows": "GitBash"
}
Run Code Online (Sandbox Code Playgroud)
我刚刚遇到了同样的问题。我的 VS Code 1.60.0 上的解决方案也是重命名Git Bash为GitBash.
在使用开发工具进行调试期间,我发现 VS Code 总是将对象值与同一键的默认值“合并”,因此:
Git Bash键的默认值为{ source: "Git Bash" }{..., "Git Bash": { "path": "D:\\Git\\usr\\bin\\bash.exe", ... }}{..., "Git Bash": { "source": "Git Bash", "path": "...", ... }}showProfileQuickPick,VS Code 调用_detectProfiles
terminal.integrated.profiles.windows该函数将和的值发送terminal.integrated.defaultProfile.windows到其_primaryOffProcessTerminalServiceprofiles只是合并后的值Git Bash在某种程度上是“非法的”,然后被忽略相反,GitBash意味着声明一个新的配置文件对象,所以它应该可以工作。
| 归档时间: |
|
| 查看次数: |
2261 次 |
| 最近记录: |