gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Let Gemini use (PowerShell or) Git Bash in Windows

Open tats-u opened this issue 1 year ago • 21 comments

What would you like to be added?

Let Windows users choose the shell for Gemini.

  • Git Bash
  • PowerShell (#2353)
  • ~~https://github.com/google/zx~~
  • https://yarnpkg.com/api/yarnpkg-shell

Why is this needed?

CMD is a really badly designed shell. It cannot be dealt even with Gemini. PowerShell (#2353) and sh-like ones is more friendly to humans and Gemini.

Claude Code uses Git Bash as the shell in Windows.

Additional context

No response

tats-u avatar Jul 03 '25 14:07 tats-u

Hmm I don't understand the issue, like you can run gemini cli on powershell/terminal if you want in Windows currently. Or maybe I understood the issue wrong.

devpool007 avatar Jul 03 '25 14:07 devpool007

I'm launching Gemini from pwsh but it can run only CMD commands and external programs. Uses pnpm dlx.

tats-u avatar Jul 03 '25 14:07 tats-u

Hi @tats-u , ah so even after launch Gemini in pwsh when you ask it to do terminal commands it executes the cmd commands internally on Windows?

devpool007 avatar Jul 03 '25 14:07 devpool007

Exactly. The scripts in package.json uses CMD in Windows.

There seems to be an environment variable ComSpec, but I don't know whether it can be controlled by Node.js processes like Gemini CLI even after they are launched.

tats-u avatar Jul 03 '25 22:07 tats-u

Disadvantages to changing ComSpec:

Many npm scripts assume that it refers to sh family in Unix and CMD in Windows. PowerShell is relatively slow to start up.

tats-u avatar Jul 03 '25 22:07 tats-u

https://yarnpkg.com/api/yarnpkg-shell

pnpm uses this when shellEmulator is activated in settings.

https://pnpm.io/cli/run#shellemulator

tats-u avatar Jul 05 '25 14:07 tats-u

Looks like Claude Code uses Git Bash in Windows (w/o WSL).

tats-u avatar Jul 12 '25 10:07 tats-u

Found possible duplicate issues:

  • #2353: (0.9336151480674744)

gsquared94 avatar Jul 30 '25 05:07 gsquared94

@gsquared94 It doesn't suggest Git Bash, which is used by Claude Code. Now that I have modified the title, please strip that tag.

tats-u avatar Jul 30 '25 09:07 tats-u

We should use git bash if possible and PowerShell otherwise.

jacob314 avatar Aug 04 '25 00:08 jacob314

We should use git bash if possible and PowerShell otherwise.

@jacob314 On Windows, PowerShell is more native But I think the best is to let user config the default shell

chencyu avatar Aug 17 '25 16:08 chencyu

I would defer to which shell generally provides the best experience for Gemini CLI. I'm open to powershell or the default shell but would be a bit biased towards a shell tha t works well for Gemini CLI where most of the model behavior is generally better optimized for mac and linux than windows so a less windows flavored shell might make some things more robust. However that is just speculation so I am open to trying powershell and giving users an option to select their shell as long as it doesn't cause too many robustness problems on our end.

jacob314 avatar Aug 21 '25 07:08 jacob314

Git Bash has lots of problems with path transformation/argument quoting, screen clearing bugs, etc. I much prefer PowerShell 7, but I agree with @chencyu that the best solution is to let users choose their own default shell.

dinhngtu avatar Aug 21 '25 15:08 dinhngtu

Let me know if you want some help with testing. I have a whole suitcase of advanced powershell scripts and modules that I'd LOVE for Gemini CLI to learn how to use. Current version can't install modules, as even "Install-Module" is unavailable from this shell.****

PC-Bjorn avatar Aug 29 '25 12:08 PC-Bjorn

We would welcome a PR to solve this if someone wants to try to implement it.

jacob314 avatar Sep 05 '25 22:09 jacob314

Same issue, I need pwsh to run the command

lowlowlower avatar Sep 29 '25 03:09 lowlowlower

This was fixed by #11157

scidomino avatar Oct 28 '25 16:10 scidomino

To be clear, I've verified that this works. When I started gemini in powershell, it uses powershell, when I started it in cmd, it uses that.

scidomino avatar Oct 28 '25 16:10 scidomino

To be clear, I've verified that this works. When I started gemini in powershell, it uses powershell, when I started it in cmd, it uses that.

Great design 🎉, let Gemini use the same with user👍

chencyu avatar Oct 29 '25 05:10 chencyu

Hi, I did not see this issue in the first place having trouble to run Gemini CLI on git bash. I came up with a wy running it and also how to let it run bash shell commands. I have provided the information as a comment to this issue: https://github.com/google-gemini/gemini-cli/issues/4999#issuecomment-3503111740

grimch avatar Nov 07 '25 15:11 grimch