Reputation: 1205
I tried to set Git Bash as the default terminal in VSCode, but I can't do it successfully. I've tried following the next articles:
But they haven't resolved my issue.
I managed to generate profiles in settings.json
, but Git Bash doesn't work for some reason unknown to me and VsCode shows an error.
My 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"
}
The error:
Does anyone know how to fix this?
My VsCode version:
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
I use git SDK, which is like git-bash but not exactly. Maybe this is the problem?
Upvotes: 7
Views: 2546
Reputation: 182
I just met a same problem. And the solution on my VS Code 1.60.0 is also to rename Git Bash
into GitBash
.
During debugging using Developer Tools, I found VS Code always "merge" object values with the default values of a same key, so:
Git Bash
key has a default value of { source: "Git Bash" }
{..., "Git Bash": { "path": "D:\\Git\\usr\\bin\\bash.exe", ... }}
{..., "Git Bash": { "source": "Git Bash", "path": "...", ... }}
showProfileQuickPick
, VS Code calls _detectProfiles
terminal.integrated.profiles.windows
and terminal.integrated.defaultProfile.windows
to its _primaryOffProcessTerminalService
profiles
is just the merged oneGit Bash
is somehow "illegal" and then ignoredOn the contrary, GitBash
means to declare a new profile object, so it should work.
Upvotes: 2
Reputation: 61
this finally worked for me
"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"
}
Upvotes: 6