Using Bash (WSL/Windows Subsystem for Linux) git for version control in RStudio on Windows 10?



I'm trying to enable git version tracking for packages on RStudio installed on a Windows 10 system. I have the Windows Subsystem for Linux with Bash for Ubuntu installed and git works fine from the bash command line.

Is there any way to get RStudio to use this git rather than having to install another version for Windows?

If it helps, one can run bash commands from the Windows command line using "bash -c" (eg. "bash -c git"). This works for Command Prompt and Powershell.

I tried setting the terminal to WSL in RStudio, but this doesn't help and I can't select the git file as access is denied from outside of bash.



Experiment with creating a script file on Windows (e.g., .bat) that calls "bash -c git" while passing all arguments and then point RStudio to this script. Also, pay attention to the location where the RSA key is stored (it may have to be stored both on Linux and on Windows).

If this does not work, then "in for a penny, in for a pound" (although Windows is the pound and git is the penny). I would install git on Windows (git and git bash for Windows work well) and, if really really needed, set up a sync of the git config file between Linux and Windows. In my view, it gets the job done without jumping through too many hoops.


A batch file with

@bash -c "git %*"

looked promising but while I get a git tab, it's empty and nothing seems to work. I guess I'll have to bite the bullet and install the windows git.