Russ Lenth
Russ Lenth

Reputation: 6790

Remove Rproj file from git repository?

I inadvertently pushed the RStudio pkg.Rproj file to my git repository, and now I'm afraid to pull it to another computer. I found this answer which says it's harmless, and maybe even desirable. But still I am not sure, because the file is created locally by setting up a project in RStudio. If the path to my project directory is different on a different machine, and that information is in .Rproj, then it'd be a mess.

Related, perhaps, is I added ther project file to .gitignore, but it still shows up in my Git window on RStudio.

What exactly is in an .Rproj file? Can anybody advise?

If I do need to remove it from my repository, is there a more elegant way to do it than copying it elsewhere locally, deleting it, pushing it (which may not work because of no .Rproj file), making a copy and then pulling it on my other PC, and restoring it on both machines?

Upvotes: 0

Views: 2530

Answers (2)

ntzortzis
ntzortzis

Reputation: 41

You could also right click on the file showing on the git tab of rstudio and select ignore.

Upvotes: 0

Alejandro C.
Alejandro C.

Reputation: 3801

You can do it with git rm --cached. e.g.

git rm --cached pkg.Rproj
git commit -m "remove rproj"

Upvotes: 4

Related Questions