6

The terminal process command 'C:\Program Files\Git\bin\bash.exe' failed to launch (exit code: 2)

1st step

2nd step

3rd step

I have already setup git. Git directory:

Git bash directory

Gama11
  • 31,714
  • 9
  • 78
  • 100
Artem Veremiyenko
  • 121
  • 1
  • 2
  • 8
  • You have checked out https://stackoverflow.com/q/38159573/3090544 and https://github.com/Microsoft/vscode/issues/20100 ? – MarkusEgle Dec 01 '18 at 18:46
  • Yeah) There are **exit code error 1** [stackoverflow](https://stackoverflow.com/questions/38159573/vs-code-integrated-terminal-issue). And i have an empty settings.json – Artem Veremiyenko Dec 02 '18 at 00:04

7 Answers7

7

I had this issue with the 'start git-bash' extention in vscode. You just need to add the folder "C:\Program Files\Git\" to your path and restart vs code.

SystemsInCode
  • 629
  • 7
  • 19
  • 1
    I had `C:\Program Files\Git\cmd` in my path but `git-bash.exe` was in the parent directory. I added parent directory to PATH after the entry I found, quit and reopened VSCode, and bingo! No idea what changed (VSCode?). Git Bash had been installed for a while, made other changes to PATH but not updating or removing the entry in the answer. – stealththeninja May 05 '20 at 01:08
4

If you have this issue, with the following error code:

'ExecutionPolicy', 'Bypass'" terminated with exit code: 2.'

What worked for me is I went into the settings.json file and removed the following line:

"terminal.integrated.shellArgs.windows": ["-ExecutionPolicy","Bypass"]
SherylHohman
  • 16,580
  • 17
  • 88
  • 94
Bocar
  • 71
  • 1
  • 3
3

I reinstalled Git and all work well

Working Git Bash

Artem Veremiyenko
  • 121
  • 1
  • 2
  • 8
1

If Git Bash doesn't work you can try installing a Windows WSL2 such as Ubuntu 18.04 and use that instead of Git Bash.

Here is how you select a Windows WSL: enter image description here

Check out this link if you need help installing WSL2 on Windows.

flyingfishcattle
  • 1,817
  • 3
  • 14
  • 25
0

You can see a similar issue (with cmd, not bash) in Microsoft/vscode issue 62953.

Try with a portable version of Git bash (like PortableGit-2.20.0.rc1.windows.1-64-bit.7z.exe), uncompress in a custom folder (like C:\Git, instead of C:\Program Files\Git)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • There are problems with **cmd**. I had problem with bash terminal, **cmd** and **powershell** works well. – Artem Veremiyenko Dec 02 '18 at 00:14
  • @ArtemVeremiyenko Yes, I mentioned this was for cmd, but the same possible context applies: try with a path which is not in C:\Program Files, and try with a Portable Visual Studio Code (the "user installer": https://code.visualstudio.com/download) – VonC Dec 02 '18 at 00:15
  • @ArtemVeremiyenko So reinstalling, as I mentioned. – VonC Dec 02 '18 at 00:20
  • I was reinstall another version (x32). Portable its didn't work. Then **I reinstalled Git and all work well** :) This issue resolved for my situation. – Artem Veremiyenko Dec 02 '18 at 00:33
0

Sometimes antivirus software might cause that behaviour, since launchin a terminal involes a process creating another process.

So add an exception in your Antivirus for Visual Studio Code or stop all the antivirus related services --at your own risk--

Mauricio Gracia Gutierrez
  • 10,288
  • 6
  • 68
  • 99
0

First, check that you have Git Bash downloaded on your PC. If you already have it installed, then check you can access python program.

If not installed, please install directly from the following link: https://git-scm.com/download/win

stealththeninja
  • 3,576
  • 1
  • 26
  • 44
  • 2
    This is an answer, which could profit from improved readability via application of appropriate formatting. Try this helpful information: https://stackoverflow.com/editing-help I also recommend to avoid asking rhetoric questions in an answer and to avoid repeating the question. Both puts an answer at risk of being mistaken as an inappropriate question (only by lazy readers like Natty of course....). – Yunnosch Apr 29 '20 at 07:20
  • Perfect English is not requied on StackOverflow (lucky me). But while you are editing for readability, you probably could fix some typos. – Yunnosch Apr 29 '20 at 07:22