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?
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.
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.
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