RStudio Desktop forking git status too often, leading to sluggishness

I'm using RStudio v1.2.5033 on Windows with no modifications to the global settings, with R version 3.6.3. The project I'm working on is hosted in my local home directory. I am using {renv}, in case that matters, but the behavior usually starts after running a few unrelated R commands.

I've been having trouble with Sophos Endpoint/HitmanPro (anti-virus/anti-malware) revving up my CPU when performing operations in RStudio. This makes running code in the console and even saving files sluggish, sometimes taking 2 minutes to respond. I thought at first that it was merely a rogue anti-virus program, but then I noticed through Windows Task Manager that RStudio is running Git quite often (about twice per second). Disabling the global setting "Enable version control for RStudio projects" makes everything work fine. Looking at the request log with Git enabled, I see a tower of get_events:

Abbreviated request log (too long for post):

    "data": {
        "file": {
            "dir": false,
            "exists": false,
            "git_status": {
                "discardable": false,
                "is_directory": false,
                "path": ".git/index.lock",
                "raw_path": "~/git/project/.git/index.lock",
                "size": 0.0000000000000000,
                "status": ""
            "lastModified": 0.0000000000000000,
            "length": 0,
            "path": "~/git/project/.git/index.lock",
            "raw_path": "C:/Users/bvancil/git/project/.git/index.lock"
        "type": 1
    "id": 6399,
    "type": "file_changed"

As you can see, RStudio thinks that .git/index.lock is changing repeatedly. Is there any way to prevent RStudio from running git status so frequently? I appreciate being able to use Git from within RStudio, but the current behavior makes this feature unusable. The weird behavior may be an interaction between RStudio Desktop and the Sophos stack, but it doesn't happen with other Git-aware applications, like Visual Studio Code.

Is the .git folder hidden in that project? We had seen some issues like this in the past when the .git folder became un-hidden for some reason.

This issue should also be fixed in the RStudio v1.3 preview release.

1 Like

No, it isn't hidden. I'll give that a try to see if that works. Thanks.

I can report that @kevinushey's suggestion to hide the .git directory itself (but not the contents!) worked great!

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