A number of users have reported issues with RStudio hanging on open with Windows. The general symptoms are:
@andrie experienced this with one of his projects, and discovered that it seemed to be linked to the usage of Git -- the hang goes away once the .git folder is deleted.
Opening RStudio with Project Explorer, it seems as though RStudio is stuck in a loop querying the project with git status, while the asynchronous package completer tries to run as well. Note that the asynchronous package completer never finishes running, but git instances keep getting repeatedly launched.

The error logs have this:
06 Feb 2018 00:32:37 [rsession-kevin] ERROR system error 5 (Access is denied) [path=C:/Users/kevin/Desktop/checkpoint/.git/index.lock]; OCCURRED AT: unsigned __int64 __cdecl rstudio::core::FilePath::size(void) const C:\jenkins\workspace\IDE\windows\src\cpp\core\FilePath.cpp:375; LOGGED FROM: unsigned __int64 __cdecl rstudio::core::FilePath::size(void) const C:\jenkins\workspace\IDE\windows\src\cpp\core\FilePath.cpp:375
06 Feb 2018 00:34:42 [rsession-kevin] ERROR system error 2 (The system cannot find the file specified) [path=C:/Users/kevin/Desktop/checkpoint/.git/index.lock]; OCCURRED AT: unsigned __int64 __cdecl rstudio::core::FilePath::size(void) const C:\jenkins\workspace\IDE\windows\src\cpp\core\FilePath.cpp:375; LOGGED FROM: unsigned __int64 __cdecl rstudio::core::FilePath::size(void) const C:\jenkins\workspace\IDE\windows\src\cpp\core\FilePath.cpp:375
Attempting to manually execute git status does succeed when launched from the command line, so it's not immediately obvious what the issue might be (unless it's the collision between these child processes that is somehow the culprit).
It looks like this issue can occur if the .git folder is no longer marked as a Hidden folder by the Windows filesystem. In that case, RStudio seems to get stuck in a loop where:
git status,index.lock file to be created,I can reproduce this by removing the Hidden attribute on any Git-managed project. I'm guessing this can happen when directories are transferred using mechanisms that don't preserve these Windows-specific filesystem attributes.
We should avoid relying on the system hidden attribute and intentionally screen the .git (and .Rproj.user) folders out from the file indexer.
This makes sense, and thank you for looking into the issue. In my case, the project was shared by Microsoft OneDrive, so this would have been the cause of the change in hidden status of the .git folder.
I can also confim that if I manually set the properties of the .git folder to hidden, the problem goes away.
Most helpful comment
It looks like this issue can occur if the
.gitfolder is no longer marked as a Hidden folder by the Windows filesystem. In that case, RStudio seems to get stuck in a loop where:git status,index.lockfile to be created,I can reproduce this by removing the Hidden attribute on any Git-managed project. I'm guessing this can happen when directories are transferred using mechanisms that don't preserve these Windows-specific filesystem attributes.
We should avoid relying on the system hidden attribute and intentionally screen the
.git(and.Rproj.user) folders out from the file indexer.