Git repo causing RStudio startup to hang



When I open old RStudio projects containing Git repos, RStudio hangs.

I set up a new Windows 10 development machine, including:

  • Installing fresh R development environment (R, RStudio, Git, RTools, MikTeX)
  • Downloading my RStudio project directories from cloud storage. These are inevitably developed as R packages, with version control managed by Git.

When I open one of these projects in RStudio, the IDE hangs on startup. The frames load, but remain blank except for the R console. The R prompt loads, but attempting to execute commands results in nothing but blank newlines. Additionally, I cannot close the RStudio session - instead, I get an infinite "Quitting R Session..." progress spinner. The only way to close the RStudio instance - apart from End Task through Task Manager, which prevents any further instances of RStudio starting at all until after reboot, even if I also end the RStudio background processes - is to first click "Terminate R" and then "Quit Session" from the "Session" menu. Even this is not reliable - I often get messages like "Error: unable to establish connection with R session" and "The application was terminated in an unusual way" and "

R encountered a fata error.

The session was terminated.". I'd include screenshots, but I'm saving my two newbie-allowed links for the logfiles.

Anyway, after some tinkering I narrowed the problem to something to do with the Git repos. If I delete or remove the .git folder, the project loads fine. If I replace it, the problems return. Strangely, if I clone the entire repo into a new directory, the project also loads without problems. That made me think the problem is buried somewhere in the bowels of .Rproj.user. So I tried removing this folder (and .Rhistory), with no effect. So whatever the issue is, it appears to be narrowly confined to the state of the .git directory, but is strangely resolved when I clone the repo.

You can find the log files on GhostBin here and here. I'm no expert, but they all seem to be related to the bundled C++ library? I had some issues during installation with an over-vigilant BitDefender blocking all kinds of innocuous components, which I thought I had resolved with exemptions and re-installations, but maybe not?

Can anyone suggest a fix?

RStudio not connecting to R session, hanging when quitting, etc

What Git binary have you configured your system to use? For example, I have on my Windows VM:


These entries in your logfiles might be related:

28 Nov 2017 04:16:34 [rsession-mixtr] ERROR system error 5 (Access is denied) [path=C:/Users/mixtr/OneDrive/Management system V1/overseer/.git/index.lock]; OCCURRED AT: bool rstudio::core::FilePath::isDirectory() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:817; LOGGED FROM: bool rstudio::core::FilePath::isDirectory() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:817

I wonder if you're running into races between RStudio and OneDrive attempting to access files within the Git directory at the same time? For what it's worth, git-managed projects tend to work poorly on Windows when located within a folder that auto-synchronizes with cloud storage.


Hi Kevin, thanks for getting back to me. I compared the internal structures of the two .git repos and they were pretty different. I'm not entirely sure why that might be, but yeah I'm switching away from auto-synced folders into a proper backup system. Since the problem is resolved I'm no longer seeking a solution, but if you're interested for the sake of bughunting I'm happy to dig up two comparative repos.