# go to your Dropbox and create your project directory
$ cd ~/Dropbox
$ mkdir my_project
$ cd my_project
# now initialize your git repo with
$ git --bare init
# As you have your remote-repo prepared, go to your local repository.
$ cd ~/dev/my_project
# First, you need to introduce the remote location to git
# this adds the specified path as the remote named 'origin'
# but you could as well name it 'Dropbox' or 'whatever'
$ git remote add origin file:///home/user/Dropbox/git/my_project
# git is set up, so push it to the remote ( 'origin' or whatever
# name you have used ).
$ git push origin master
Something I would be more concerned about is the following scenario:
1. Alice commits to her working directory and pushes (to the Dropbox remote).
2. Bob commits to his working directory and pushes (to the Dropbox remote).
3. Bob's Dropbox folder syncs.
4. Alice's Dropbox folder syncs *CHAOS?*
How does Dropbox resolve conflicts? I really, really don't want to
resolve a merge conflict inside my remote...
> When DropBox has conflicts (e.g. you had a file open while it was deleted,
> or two people edited a file and tried to sync), it renames files, appending
> a reason for the renaming (e.g. "deleted" or "conflict" and a hash) so you
> could get
> a) just Alice's files (if she synced first) + bob's put in there with funny
> names — at least shouldn't break it
> b) just Bob's files (if he synced first) + alice's put in there with funny
> names — also shouldn't break it
> c) a mix of the two! (under race conditions) — watch out for sharks
I think a and b will still break. Git will think the commit succeeded
and dropbox will automatically resolve the conflicts this way. The
next time git is invoked on the remote it will probably see part of
one commit and part of the other in a way that it cannot resolve. Of
course you can probably force repair the remote and then push again,
but you may end up in the same situation.
The underlying problem here is that you never want dropbox to resolve
conflicts. Can you force a dropbox sync? In this case, add a git push
hook in your remote to sync with dropbox before and after pushing.
That way git will stop the push and force you to merge/rebase if there
are conflicts. There's still a race condition where the pre-hook can
see no changes and the post-hook can see changes. It's unlikely, but
"unlikely" in software development usually means a problem you never
hit until an hour before the release deadline.
As far as I've ever found there is no way to tell dropbox what to do or when to do it. The whole innovation behind dropbox is that it's a versioning repo for idiots, all the actual tech is hidden from the end user.
That said, if anyone does know a way of forcing a synch other than logging out/in please let me know, that'd be really handy.
-DKW