This is an old revision of the document!
This tutorial describes how to store your keepass db on the SDF in Git and access it from everywhere. It is based on KeePassX on Windows Vista, Debian Squeeze and NetBSD 4 but should work with any other OS supporting Git and KeePassX, KeePass or KeePass2.
cd ~ mkdir .git cd .git mkdir keepass cd keepass git –bare init
cd ~ mkdir keepass cd keepass git init
Now copy the keepass.sh and your keepass db (here: keepass.kdb) to ~/keepass
git add keepass.sh keepass.kdb git commit git remote add origin user@odin.sdfeu.org:.git/keepass git push origin master
When you start the script, it will try to get the latest version of your keepass db. If there was no successful connection to the server, it will open a read-only version of keepass for you. If the Git pull was successful, the script generates a lock file globally and opens keepass. This prevents that you have opened keepass in write-mode on two or more locations simultanously. When you close keepass, all changes will be commited and pushed to your git server again.
#!/bin/bash git pull origin master if [ $? -gt 0 ]; then echo "====================================" echo "Can't connect to Git server" echo "Keepass db will be READONLY" echo "====================================" touch keepass.kdb.lock keepassx keepass.kdb rm keepass.kdb.lock exit else if [ -f keepass.kdb.scriptlock ]; then echo "=========================================" echo "Keepass is already running somewhere else" echo "=========================================" exit else touch keepass.kdb.scriptlock git add keepass.kdb.scriptlock git commit -am "created lock file" git push keepassx keepass.kdb rm keepass.kdb.scriptlock git rm keepass.kdb.scriptlock git commit -am "deleted lock file" git push fi fi