Stop Dropbox from syncing .git and .Rproj.user in RStudio project folders

Contents
  1. Exclude target files from syncing in Dropbox
  2. Open the Dropbox folder
  3. Exclude .git and .Rproj.user from syncing
  4. Check the folders

When you use RStudio, Dropbox can sometimes get stuck in a constant syncing state. RStudio's project file monitoring feature seems to conflict with temporary Git files. To prevent this, you need to exclude the .git and .Rproj.user folders from syncing in your Dropbox settings.

"When you create a project inside RStudio, it actively monitors the project files for changes. Dropbox also actively monitors files. To prevent conflicts, you need to tell Dropbox to ignore the .Rproj.user directory." https://t.co/ONckvs7o3m

— Shoei (@shoei05) December 5, 2020

"When I start RStudio, Dropbox goes crazy trying to index a file called .git/index.lock. When I checked, that file keeps appearing and disappearing in the .git subfolder of the project folder." https://t.co/NluffHJOxA

— Shoei (@shoei05) December 5, 2020

See this post for instructions on managing RStudio projects with GitHub.

https://plaza.umin.ac.jp/shoei05/wp/index.php/2020/10/25/165/

I have summarized how to run RStudio on Docker in this post.

https://plaza.umin.ac.jp/shoei05/wp/index.php/2020/10/17/56/

https://plaza.umin.ac.jp/shoei05/wp/index.php/2020/10/30/196/

Exclude target files from syncing in Dropbox

Due to the current Dropbox UI, you might think of three main ways to do this:

  1. Right-clicking the folder in File Explorer (Finder on Mac) to uncheck the sync option
  2. Selecting the folder in the Dropbox web application and excluding it from syncing
  3. Excluding it from syncing through the Dropbox desktop application

However, to get straight to the point, only the third method actually worked.

Open the Dropbox folder

Click the Dropbox icon in the taskbar (or menu bar), then click the folder icon (outlined in red) next to your username.

Exclude .git and .Rproj.user from syncing

Navigate to your project folder, right-click the target .git and .Rproj.user folders, and select "Don't sync to dropbox.com".

This stops them from syncing.

Check the folders

Let's check in File Explorer (or Finder) to confirm that the folders are no longer syncing. Because temporary files are hidden, you first need to make hidden files visible. On a Mac, press ⌘ + Shift + . (period) to show hidden files.

This isn't particularly complicated, but I couldn't find many posts that laid out the steps clearly, so I wrote this down for my own reference. I hope you find it useful.

I created the "rstan" project folder shown above for a Bayesian statistics course from Sugaku Bunka ((Introduction to Bayesian Statistics | Sugaku Bunka. Published December 5, 2015. Accessed February 21, 2021. https://sugakubunka.com/bayesian_statistics/)) that I am currently taking.

I am enrolled in the second-half course for 2020 and have online lectures every Saturday through February. Classes that previously required traveling to a classroom in Osaka or Tokyo are now available online, which has been a huge help for someone living far away like me.

English translation of the Japanese article.