You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

mind_over_machine's avatar
mind_over_machine
Explorer | Level 4
2 years ago

Can Dropbox handle git repostories? ONLY as a secondary backup?

Hello,  I have a script that copies my git repositories into Dropbox every 10  minutes.  It only copies modified files. This includes .git subfolders folders as well as my code files. In total thi...
  • Mark R.96's avatar
    2 years ago

    For GitHub + Dropbox + Git:

     

    If your priority is worktree syncing between your own machines, while using a remote repository (e.g. github):

     

    I solved my problem by forcing Dropbox to ignore my .git subfolders.

     

    That syncs my personal worktrees, while leaving github alone. Be careful about how it works though, and only do it only for your own account (e.g. your own PC and your own laptop). I simply have to re-pull from my other machine (directly from github) when I push from one machine, to make sure that the git data is in sync with each other.

     

    It behaves as if you copied over the files manually via thumbdrive (excluding .git), so make sure you re-pull git everytime you switch machines. And always remember to switch branches on both machines manually, every time you switch branches.

     

    Instructions for Windows (run in PowerShell):

    Set-Content -Path 'C:\path-to-project-inside-dropbox\.git' -Stream com.dropbox.ignored -Value 1


    Instructions for Mac:

    xattr -w com.dropbox.ignored 1 /path-to-project-inside-dropbox/.git

     

    Instructions for Linux:

     

    attr -s com.dropbox.ignored -V 1 /path-to-project-inside-dropbox/.git

     

    It's convenient when you have a lot of data/logs/object files/etc (anything big in .gitignore but you let sync in Dropbox, as LAN sync is fast enough to sync the big stuff).

     

    Dropbox syncing all the data and object files allows faster compiles of larger projects on both owned machines after minor modifications (for same-OS x64), and easier comparative testing on the other machine.

     

    And keeps github unpolluted.

     

    This is better than the selective sync system because of all the automatic "selective sync conflicts". This method forces Dropbox to completely ignore everything in specific subfolders, as if it didn't exist.

     

    And if you mess up, you also have a double backup of github and Dropbox to rewind to (both have separate convenient recovery use cases, like resurrecting specific logfiles).

     

    Note: There are many variations on (less safe) Dropbox+Git workflows. Some people use a separate side workflow to sync .git folders (preferably via git pull sanctioned methods, but some people manually copy the folder over after pausing development temporarily on both machines).  Another workflow is to temporarily pause the dropbox process automatically before a bunch of git commands ("pssuspend Dropbox" to pause Dropbox, and "pssuspend -r Dropbox" to resume Dropbox) but that is still riskier than this workflow.  I simply mention this as an additional alternative, that is more appropriate to certain single-developer use cases. Such workflows is not typically recommended for multiple-developer repositories, as corruption can happen.