rig icon indicating copy to clipboard operation
rig copied to clipboard

Can't specify git bash as terminal when running rstudio through rig

Open wzbillings opened this issue 9 months ago • 6 comments

When I launch RStudio manually, I can set "Git Bash" as the option for the terminal. I'm talking about the option under "Global Options" -> "Terminal" in left-hand menu -> "New terminals open with" dropdown menu.

When I launch RStudio via rig rstudio, the option for Git Bash isn't present in the list of options for opening a terminal.

If I launch RStudio via rig rstudio and I set the option for the terminal to "Custom" with the path to my global git bash path, RStudio will open a terminal in another window -- I'd like to have it embedded as usual if possible.

I see from the console output when running rig rstudio that it runs cmd.exe /c start /b rstudio. Is the problem that Git Bash isn't in the path when this happens? I'm used to bash and not that familiar with cmd so I don't know if that's the same problem, or how to fix it. I tried searching through the other issues in this repo and online but didn't find anyone else with the same issue. However, if I check in Powershell ([Environment]::GetEnvironmentVariable("PATH")), the path to my git bash exe is in there, so I'm not sure why RStudio can't find Git Bash when I open it through Rig.

I'm fairly sure that the Git installation is not the problem -- I have Git/Git Bash installed in the usual Program Files location, and I can use git through any of the terminals that open in RStudio.

I'm using rig 0.7.0, R 4.4.2 (installed through rig), and RStudio 2024.12.0 Build 467 (installed manually), if any of that is relevant.

Thanks in advance!!

wzbillings avatar Feb 10 '25 16:02 wzbillings

Have you tried putting git bash on the PATH?

gaborcsardi avatar Feb 10 '25 16:02 gaborcsardi

Yes, I added it to the windows machine-level path in Powershell. when I check the path in cmd, it shows up.

wzbillings avatar Feb 10 '25 17:02 wzbillings

rig does not use powershell to start RStudio, so try setting the PATH in your user's config, or the global config.

gaborcsardi avatar Feb 10 '25 18:02 gaborcsardi

I'm not sure I understand you. The exe for Git Bash is already in my bash PATH. The exe for Git Bash is also in the PATH for cmd, which Rig does use (cmd and powershell share windows environment variables).

But RStudio still can't "see" Git Bash as an option when I launch it through rig rstudio in my bash terminal. I'm not sure where else I should be adding git bash to the PATH.

wzbillings avatar Feb 10 '25 18:02 wzbillings

I meant like this: https://www.computerhope.com/issues/ch000549.htm#windows11

(You'll have to restart the shell after this, probably.)

What does R (in Rstudio started with rig) give you for

Sys.which("bash")

?

gaborcsardi avatar Feb 10 '25 19:02 gaborcsardi

I meant like this: https://www.computerhope.com/issues/ch000549.htm#windows11

(You'll have to restart the shell after this, probably.)

Yep when I check the GUI it is set in there. Setting the environment variable in powershell does the same thing, but I double checked just in case. The path to git bash is in both my local and system environment variables.

What does R (in Rstudio started with rig) give you for

Sys.which("bash")

?

It returns "C:\\WINDOWS\\SYSTEM32\\bash.exe", which is the WSL bash terminal (I can select this as an option in RStudio's dropdown menu regardless of if I start RStudio via Rig or manually).

If I check Sys.which("git-bash") it returns "C:\\PROGRA~1\\Git\\git-bash.exe", which is correct. I added this literally to the PATH with the abbreviation to see what happened, and (unsurprisingly) it didn't fix the problem, cause the abbreviation resolves to the correct file path. I get the exact same results when I run those options in RStudio started without using Rig.

It's strange to me that RStudio is able to find the git bash executable when I start it with Rig and the option just isn't there in the dropdown menu I'm looking at. (But still, if I start RStudio without Rig, it is an option.)

wzbillings avatar Feb 12 '25 16:02 wzbillings