Using Git in R-studio: cannot stage modified code files

I am new to using git and currently employ the following combination:

  • Git-Gui v.0.20
  • R-studio 0.99.489
  • R 3.22
  • Bitbucket code repository
  • Windows 7

Until recently this combination worked fine for pulling and pushing code to the repository. But now I cannot push modified code anymore nor commit it in R-studio.
In R-studio, modified code is marked by a blue M with a checkbox next to it. I cannot check this box for staging, committing and pushing anymore. It literally does not check and react when I click on it.

When I create a new code sniplet which shows as yellow question mark ? I can check and push it, but modified versions cannot be checked anymore.

I have already deinstalled git and R-studio and re-installed but the problem persists. I also created a new repository but the problem occured in the new repository as well. I am a bit clueless where to start looking for a soluation and a web search did not yield many results except this discussion here, which I cannot fully follow because it perhaps does not apply fully to my problem. In any case when I give

> Sys.which('git')

R returns:

git 
 "" 

I would appreciate advice where to go from here.

  • Is there a way to change the file path for an Rstudio project?
  • git2r::summary() produces different results when called from console and by RStudio
  • Pushing to Github from RStudio
  • Create an offline version control for R Studio
  • Changing Git protocol for RStudio project already under version control in Windows
  • rstudio push 'rpostback-askpass' error
  • Fastest way to get version controlled code back into RStudio
  • RStudio gives “Incorrect function” when setting git as Version control
  • 2 Solutions collect form web for “Using Git in R-studio: cannot stage modified code files”

    I found an answer to my question. It is a bug in RStudio, albeit not a very well documented one.

    When there is a space in the .R file name, it is not possible to push the file through git. Removing the space solves the problem.

    See here for an official comment on the Rstudio board dating February 2015. I am using the most recent version of Rstudio and it is not yet fixed there.

    Try if the issue persists with:

    • the latest git for Windows unzipped anywhere you want: PortableGit-2.6.3-64-bit.7z.exe
    • its path added to %PATH%:

      set PATH=%PATH%;C:\path\to\PortableGit-2.6.3-64-bit\bin
      
    • its path declare in R-Studio C:\path\to\PortableGit-2.6.3-64-bit\bin\git.exe

    • R-Studio itself launched from a CMD session where %PATH% already references git.
    Git Baby is a git and github fan, let's start git clone.