Backing up Evernote with Git and Dropbox

What's Evernote?

Imagine a lightweight word processor. Like Microsoft Word but 50 times faster. Then abstract out the concept of a file system so that instead of having to keep track of hundreds of files around your hard drive, you only have "notebooks" and "notes" to deal with all in one application. Now make them searchable. And finally, put the whole thing in the cloud so that you can access your notes on your computer, through the web, or on an iPhone. That's Evernote. It's as amazing as it sounds.

Why back up your notes?

Because sometimes cloud-based systems have issues. Or maybe you accidentally nuke an entire notebook. Or perhaps you want all your notebooks to be "local notebooks", and not replicated to Evernote's cloud. No matter the reason, it's your data, and you have a right to have backup copies.

Skill Level: Advanced

You should be comfortable on the UNIX command line, and know your way around Git and other command line utilities. Software Engineers and sysadmins will get the most out of this tutoral. Be sure to read the warning at the end.

A Note About Locations

Depending on how you installed Evernote, your notes could be stored in one of 3 different locations. According to this post, the list of possibilities is:

  • Direct download from Evernote
    Users/Your Username Here/Library/Application Support/Evernote
  • Appstore download from Apple
    Users/Your Username Here/Library/Containers/com.evernote.Evernote
  • Appstore download on Mac with a fusion drive
    Users/Your Username Here/Library/Containers/com.evernote.Evernote/Data/Library/Application Support/Evernote/

Since my Mac has a fusion drive, I will use the last example. If your notes are in a different location, please season these directions to taste.

Putting Your Evernotes into Git

If you've used Git before, the following should be straightforward. We're going to go into our directory which contains notebooks, create a Git repository, and add all of our files.

cd $HOME/Library/Containers/com.evernote.Evernote/Data/Library/Application Support/Evernote/accounts/Evernote

$ git init
Initialized empty Git repository in /Users/doug/Library/Containers/com.evernote.Evernote/Data/Library/Application Support/Evernote/accounts/Evernote/.git/

$ git add .

# Verify that we have files added to Git.
$ git status |head -n20
# On branch master
# Initial commit
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#       new file:   dmuth/Evernote.sql
#       new file:   dmuth/announcements/localStorage
#       new file:   dmuth/atlas/localStorage
#       new file:   dmuth/content/p101/69356fa7ddb42bced63235bbb1010561.jpeg
#       new file:   dmuth/content/p101/69356fa7ddb42bced63235bbb1010561.reco

# Now commit our files.
$ git commit -m "Initial Evernote Checkin"

# Make sure nothing remains to be added to Git.
$ git status
# On branch master nothing to commit, working directory clean

Getting Your Evernotes Into Dropbox

Now that your Evernotes are stored in Git, we want to get a copy of that repository up onto Dropbox for safe keeping. To do that, change into your Dropbox folder and clone the repository you just created:

$ cd $HOME/Dropbox/
$ git clone --bare --no-hardlinks  "$HOME/Library/Containers/com.evernote.Evernote/Data/Library/Application Support/Evernote/accounts/Evernote" 
Cloning into bare repository 'Evernote.git'...

At this point, if the Dropbox client is currently running, you can expect it to go bonkers are it syncs all of the files in the Git repository up to Dropbox's servers. Depending on the size of your Evernote directory, you may want to step away from the keyboard and grab a coffee or something.

Set up Dropbox as a Remote

One more step left, and that's to set up your original Git repo to point to the clone in Dropbox. This can be done by going back to the original Evernote directory and adding in a new remote called "origin":

$ cd $HOME/Library/Containers/com.evernote.Evernote/Data/Library/Application Support/Evernote/accounts/Evernote
$ git remote add origin /Users/doug/Dropbox/Evernote.git/
$ git push --set-upstream origin master
Branch master set up to track remote branch master from origin.
Everything up-to-date

With a remote of "origin", after checking in future changes, all it will take is a "git push" to send those changes off to the Dropbox folder, at which point they'll be synced up to Dropbox.

Cloning Evernotes onto a New Hard Drive

This last part isn't strictly necessary. If you're setting up Evernote on a new computer, you could just as easily log into Evernote and let it download its copies of the notes. However, if you have local notebooks, then this is step is absolutely necessary.

The first thing you'll need to do is run Evernote and log in. This will set up the Evernote directory on your machine. As soon as you log in, you can even quit Evernote before it is done syncing, if you wish. Next, run these commands:

$ cd $HOME/Library/Containers/com.evernote.Evernote/Data/Library/Application Support/Evernote/accounts/Evernote
$ git clone --no-hardlinks ~/Dropbox/Evernote.git/ .
Cloning into '.'...

That's it! When you start Evernote back up, you should have all of your notes.


It's a good idea to make sure that Evernote is not running when adding files to Git. You don't want to the data in Git to be in an inconsistent state.

It's also a good idea to make sure that your Dropbox folder is completely synced before disconnecting from Dropbox. Otherwise, your Git repo in Dropbox may be in an inconsistent state. Strictly speaking, using Dropbox for a Git repo isn't the best idea ever, but it can work as long as care is taken.

Happy Evernoting!

Average: 4.5 (2 votes)
Your rating: None