Force git to treat Keynote files as binary

less than 1 minute read

I was recently putting together a repo for presentations I’ve given, and I kept running into an annoying issue. Git would treat my Keynote files as a directory, which ends up looking like this:

$ git status
    new file:   presentation.key/Data/st-ED415AB1-F3E3-40E7-AE3C-62C8F48D61F2-1769.jpg
    new file:   presentation.key/Data/st-FA2A3A03-7617-4164-9E65-1304161A58D5-2058.jpg
    new file:   presentation.key/Metadata/BuildVersionHistory.plist
    new file:   presentation.key/Metadata/DocumentIdentifier
    new file:   presentation.key/Metadata/Properties.plist
    new file:   presentation.key/preview-micro.jpg
    new file:   presentation.key/preview-web.jpg
    new file:   presentation.key/preview.jpg

I just want the files there as binary, so that anyone can download them if they like.

I tried a few different things, including a .gitattributes file with *.key binary, using different versions of git, and even different versions of OS X (el Capitan and Sierra).

In the end, the problem was from when I had saved the presentations. The hide file extension option in Keynote’s save dialog was the problem. De-selecting that option is all it took for it to work as I wanted (and as I think most people would expect).