Git bash uses different home directory in RStudio 2022.12.0 on Windows

I've just installed the latest RStudio - 2022.12.0 and noticed that Git Bash terminal inside RStudio is using different home directory than Git Bash terminal started independently, and hence is looking for .gitconfig and SSH keys in incorrect locations.

To be exact, inside RStudio version 2022.12.0 Git Bash terminal ~ points to C:\Users\<my_user>\Documents, while when I start Git bash separately, and in previous RStudio release (2022.07.02) as well, it points to C:\Users\<my_user>.

How could I change it? I'd like all Git Bash terminals to behave the same no matter where I start them. I'd prefer NOT to set HOME environmental variable globally, because then it affects R session as well, and I'd like to keep the current behaviour there.

5 Likes

I am facing the same issue since the upgrade to RStudio 2022.12.0+353 "Elsbeth Geranium" Release (7d165dcfc1b6d300eb247738db2c7076234f6ef0, 2022-12-03) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2022.12.0+353 Chrome/102.0.5005.167 Electron/19.1.3 Safari/537.36

1 Like

You can change the default working directory in Tools->Global Options->General. I changed "default working directory" to C:\Users<my_user>. Restarted Rstudio, and the terminal directory matched.

image

I might be doing something wrong, but I tried the Tools->Global Options->General approach and only works when you are in no project (as is stated in the prompt).
However in the previous version of R studio, it didnt matter if you were in a project, home was the same in all Git Bash terminals

2 Likes

As @RubenR said, it works only outside the project. I haven't found any solution so far, as a workaround I simply open separate Git Bash window instead of terminal inside RStudio, but this is less convenient.
What's more, Git panel in RStudio is working just fine, because it is pointing to the correct SSH key, and you can even configure it. But I am used to working with terminal, so this is not an option for me.

I would really appreciate if someone provides some clever solution to this problem.

4 Likes

Agreed - having the same problem and changing the default working directory within RStudio does not resolve it. The Git client tab in the upper right pane does work (albeit, with the limited functionality that offers).

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.