Using Dropbox to synchronize files and having them backed up in version control

I’m using dropbox for random text notes (org-mode) and dot files that I bootstrap, namely

  1. part of my bash initialization
  2. emacs configuration
  3. vim configuration

Org-mode documentation suggests some backup in case of a mistake in editing folded sections. Makes sense. I also want backups in case I want to back out configuration change.

  • Strange git error
  • Syncing git repositories across computers
  • Using git without (or with limited) revision history?
  • git + dropbox problem
  • How do I keep GIT repositories inside Dropbox?
  • dropbox-style svn/git/mercurial?: auto-commit upon change and auto-checkout
  • There are tons of postings on why using git can break in dropbox.

    I see a few options:

    1. Not use dropbox and use bitbucket to host the files on git. The disadvantage is that when I switch machines, I have to remember to pull any changes, which is not convenient.

    2. I can use git via a chron job on one of my machines to backup the files in the dropbox folder and make sure that the git directory is not sync’d by dropbox. The disadvantage would be that this is a little asymetrical in that one machine has git on the dropbox files . However, the history is just for backup purposes rather than collaboration purposes.

    3. Not worry about the dropbox issues, as I infrequently commit changes and hardly do any other commands with the git repositories.

    4. Maybe a combination of #1 and #2. Occasionally push my changes to remote, having the .git directory not sync’d.

  • How to make pull request to Visual Studio Online
  • Git access to private repository using HTTPS
  • Why I get remote: sh: 2: Syntax error: Unterminated quoted string when I ran git push heroku master
  • Function in bash to commit and push in one command
  • Finding a file by its corresponding blob's hash in a git repository?
  • Cloning Git repository throwing ArithmeticException
  • One Solution collect form web for “Using Dropbox to synchronize files and having them backed up in version control”

    You can use dropbox, just not for a full bare Git repo (because of the high number of files to synchronize and the risk for a corrupted repo if even one of those file doesn’t get sync properly, as shown in “Git ref master now empty, how to recover?”).

    I prefer to use dropbox in conjunction with a git repo bundle (ie one file):
    See “Git with Dropbox” and “Backup a Local Git Repository”.
    See a detailed analysis in this blog post.

    You can see an example of a script for that kind of task here (example by shtirlic (Serg Podtynnyi)):

    #!/usr/bin/env ruby
    if __FILE__ == $0
            bundle_name = ARGV[0] if (ARGV[0])
            bundle_name = `pwd`.split('/').last.chomp if bundle_name.nil?
            bundle_name += ".git.bundle"
            puts "Backing up to bundle #{bundle_name}"
            `git bundle create ~/Dropbox/backup/git-repos/#{bundle_name} --all`
    end
    
    Git Baby is a git and github fan, let's start git clone.