We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

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.

About Apps and Installations

Have a question about a Dropbox app or installation? Reach out to the Dropbox Community and get solutions, help, and advice from members.

Need more support

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!