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
2 years agoExplorer | Level 4
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...
- 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.
Megan
Dropbox Staff
Hi mind_over_machine, thanks for posting here!
Keep in mind, that once the file is copied into Dropbox then the only thing left from there is to sync the file.
It shouldn't be a problem really. In some cases, it might just be best to pause or close the app and just allow for the content to sync and backup. Since doing it every 10 mins might have an issue if they're large files. (for example: it starts syncing a change/addition and then another file is added or a file is edited before the initial one finishes syncing)
If you have any questions, let me know!
mind_over_machine
2 years agoExplorer | Level 4
Thanks Megan!
Yeah I totally understand, I can set a longer delay and allow Dropbox to catch up.
Was just concerned about the integrity of .git subfolder syncing correctly on your end.
Whew.
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!