2

I have Git Bash and WSL Bash installed. Currently bash command is associated to WSL Bash. Can I link it to Git bash instead?

5
  • You would have to change order of the paths within your PATH variable. Have you tried that?
    – Ramhound
    Jul 27, 2020 at 16:46
  • @Ramhound WSL Bash is located in the System32 folder, which is not included in PATH variable of my machine
    – Max
    Jul 27, 2020 at 19:38
  • I will repeat my suggestion since your last comment does not really answer the question I raised. The path to GIT bash should be the first entry in the system variable, this will make it so Git bash is the first application found, instead of WSL bash.exe.
    – Ramhound
    Jul 27, 2020 at 20:16
  • @Ramhound Yeah, I tried. It doesn't work even if I put `C:\Program Files\Git\usr\bin` to the first row of PATH variable.
    – Max
    Jul 28, 2020 at 15:36
  • 1

1 Answer 1

0

There may be cleaner solutions, but I was able to get around this by doing either of the following:

  1. Specify the absolute path to Git Bash's bash executable each time:
& "C:\Program Files\Git\usr\bin\bash.exe" -c "echo hello"
  1. Create a Powershell alias for Git Bash's bash executable and use that:
New-Alias -Name git-bash -Value "C:\Program Files\Git\usr\bin\bash.exe"
git-bash -c "echo hello"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .