Using GIT in combination with Zotero for version control and collaboration

I am looking into using Zotero for collaboration at work. I would love to be able to use the built in sync capabilities but I am not able to use an external website for the storage of the information. I read that there are problems using a cloud based solution getting corrupted. I thought that using GIT might help with this and also provide version control as well. Has anyone done this? If so, what was your experience in setting this up?
  • It won't work.
    Think through the workflow:
    Every time you are finished working with Zotero, you'd have to quit the program (so the db is properly closed) and then git add, commit and push. Only then can other people git pull and see your changes. So far this is just inconvenient. But now imagine the -- very likely -- scenario where two of you work in Zotero at the same time. Now you get a merge conflict on a 100MB+ sqlite file. I don't think you're going to resolve that...

    Also, of course, you don't get the group functionality which is part of what makes groups attractive.

    It's generally possible to run a local Zotero server and some people do this. That said, all documentation I'm aware of is for Zotero 4, whereas this should work much better with Zotero 5.
  • Adamsmith, thank you for your comment. Can you give me a pointer to the documentation on how to setup a local server? I think that would be more ideal--I didn't realize that was possible.
  • As I said, there is no up-to-date documentation for this, but the source code is here: https://github.com/zotero/dataserver

    Zotero has mentioned that they're planning to release a Docker image that'd make this pretty easy to install.

    While you would likely be able to find old instructions, I'd really advise against going that route. Among other things, Zotero 4 with a local server requires patched clients, whereas Zotero 5 has a hidden preference for the sync endpoint.
  • edited February 19, 2019
    Until Zotero is capable of syncing with our institutes private server, I'm using Git to backup my database and have it accessible remotely at least in an unidirectional manner. (I only push from one machine and never pull since it would be very likely to fail when editing the database from multiple machines as discussed above.)
    To automate the process and to make sure that Zotero is closed upon backup, I use the following script (in Git Bash on Windows):
    #!/bin/bash
    if tasklist | grep --quiet zotero; then # returns 0 if zotero process was found, 1 elsewise
    read -n1 -r -p "Commit failed, please exit Zotero first!" key
    else
    git add .
    git commit -m "`date +\"%Y%m%d-%H%M%S\"`"
    git push origin master
    fi
Sign In or Register to comment.