4

Question about Git and Dropbox. I set up Git and Dropbox using the various tutorials online. When I push up my project, I notice that the dropbox folder is very small (1mb vs about 4 on my local machine). I'm pretty sure that the actual files aren't being pushed up to dropbox. Is this normal?

Thanks!

Astephen2
  • 821
  • 4
  • 13
  • 20
  • In your Dropbox folder, you just have the git repository, whereas in your local machine you have a clone of the repository plus the working files. That should account for about a 2x difference. – Ravi Jan 27 '12 at 05:14
  • Ah. So if my local machine were to crash (knock on wood), would I be able to do a comprehensive backup from my dropbox? – Astephen2 Jan 27 '12 at 05:22
  • Yes, you have a full copy of the repo on both Dropbox and your machine. – Ravi Jan 27 '12 at 05:32

2 Answers2

8

As it was already pointed out, Dropbox isn't the safest solution to share your repo (see "Is this plain stupid: GIT Sharing Via DropBox?".

Greg Bacon remarked that Dropbox already retains old versions of files, which is a bit redundant with what Git already does.

See "this discussion" (which was about a full repo backup, not just a bare repo though):

Well, Dropbox is known for becoming slow when syncing lots of files and Git, by design, creates lots of files on your harddrive. You can encourage packing those many loose objects into few packed objects by running git gc on a regular basis though.

Also Dropbox will start syncing stuff as soon as you do basically anything: checkout, stash, commit, fetch, rebase, reset etc. I'd fear that if I was working too fast, Dropbox would start creating conflicted copies of my files.

Even worse, Git's internal storage is even more fragile (Git is by no means a backup method!) and because Dropbox was designed to handle your average .doc files, it is just too careless when it comes to manipulating files or filenames. If something in there fails, you might see yourself out of luck.

I use dropbox with a git bundle: only one file to synchronize.
Much less issues that way (but that also means that local setups like hooks aren't part of my bundle).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
3

you might consider telling dropbox to ignore the .git directories in your repo. i use dropbox to keep copies of my files (in case i do something dumb with git and nuke my changes), but i don't need dropbox to keep a copy of the .git directories.

in dropbox prefs, under advanced there's a section called "selective sync" that allows you to disable syncing of specific folders.

kolywater
  • 61
  • 3
  • Could you provide some additional information on how you would selectively ignore .git folders? I'm thinking of using git + dropbox, but I can't find a good way to do what you've stated. – Bobby B May 23 '12 at 21:04
  • 1
    if you click on the dropbox menu icon, and go to preferences -> advanced you'll see "selective sync." simply uncheck .git directories. – kolywater Jun 08 '12 at 13:06
  • 4
    unfortunately, it seems ignoring folders in dropbox means they will also be removed from your local dropbox folder, so you have to make copies of the .git dirs, uncheck them in selective sync, then let dropbox delete them, and finally move the .git folders back in. – kolywater Jun 08 '12 at 13:14