Is it a good practice to push renv folder and renv.lock file to github along with other files

Is it a good practice to push renv folder and renv.lock file to github along with other files?

So basically, I have a project(created as a package) where I have set renv package management.
So when I push my other files to GITHUB, is it required to push renv folder and renv.lock file so that other developer who pulls the same project can use it

How this renv works between developers?

1 Like

Yes, the project package library created by renv consists of symbolic links pointing to a global package cache so they do not get pushed to github unnecessarily (unless you explicitly isolate your project).

When another person clones your project and loads it, they get warned that the project is out of sync and they should run renv::restore() to fix it

So to double check, we have to push both renv folder and renv.lock file?

I think you should stick to the default .gitignore file created by renv::init()(which ignores the project's private library) unless you have a specific reason for doing otherwise.

This is what I have in .gitignore.
This does not include project's private library

your renv subfolder likely includes its own .gitignore file which I would expect will exclude
sandbox/
library/
local/
cellar/
lock/
python/
staging/

make sense thanks... But outside renv folder , there is a file created called renv.lock. So as per you, this is not included in gitignore so we need to push it? Right?

So when another developer pulls my project he can restore it? Is my understanding correct?

yes; the renv.lock is the most precious element, and should absolutely be git committed.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.