tomka
tomka

Reputation: 2638

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

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

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.

Upvotes: 10

Views: 2508

Answers (2)

tomka
tomka

Reputation: 2638

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.

Upvotes: 15

VonC
VonC

Reputation: 1323165

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.

Upvotes: 4

Related Questions