What am I doing wrong here with what should be a simple sync between devices and a remote?
I've looked at other answers here and ended up more confused after trying some of the suggested solutions. This has got to be something really simple.
The scenario:
what I'm trying to do:
I want to synchronize between a local copy of a kdbx database between multiple devices. For the purposes of this discusson, I'll simply define two devices used locally and my remote Git repo on a gitea server:
- My Gitea server (we'll call this gitea.host)
An empty repo has been created on this remote Git server called, kdbx.
- My laptop / desktop device (we'll call this laptop)
KeePassXC and the companion browser plugin has been installed in Firefox on laptop. Git is also installed.
The database being used by KeePassXC is joeuser.kdbx
- My Android device (we'll call this device, android)
KeePassDX has been installed on android. I also have Termux installed.
Initial setup:
- On android we open termux perform the following:
pkg install git
pkg install vim
cd storage/shared
mkdir private/keys
cd private/keys
git config --global user.name "joeuser"
git config --global user.email "joeuser@gmail.com"
git clone https://gitea.host/joeuser/kdbx.git
Open KeepassDX, choose joeuser.kdbx and check... All entries are there and it is working.
- On laptop we perform the following:
cd /home/joeuser
mkdir private/keys
cd private/keys
git config --global user.name "joeuser"
git config --global user.email "joeuser@gmail.com"
git clone https://gitea.host/joeuser/kdbx.git
move joeuser.kdbx from wherever it is to /home/joeuser/private/keys/kdbx
Open KeepassXC, connect to /home/joeuser/private/keys/kdbx/joeuser.kdbx and check... All entries are there and it is working.
Add new entry in database on 'laptop' and sync with remote:
It doesn't really matter which device we use first, but for this example we'll start with laptop
NOTE: We've also installed the KeePassXC browser plugin which will be used here.
- Open KeePassXC, unlock the database, joeuser.kdbx
- Open browser (For example, Firefox) and visit a site like, for example, https://joeuser.com
- login, and the browser plugin asks if you wish to add the uid/pwd combo into a new entry, and accept.
- Go back to KeePassXC and verify there's now an entry in the kdbx database. Everything looks good.
- Push the database to remote origin:
git add .
git merge -m "added entry in kdbx"
git push
sync 'android' with remote:
1 Open termux and perform the following:
cd storage/shared/private/keys/kdbx
git pull
- Open KeePassDX, and connect to the database private/keys/kdbx/joeuser.kdbx
- check for the login entry for joeuser.com and it is there.
- Go back to KeePassDX, add another uid/pwd entry in the database.
- in the termux session, perform:
git add .
git merge -m "added another entry in db"
git push
At this point everything comes to a screeching halt. a push, a pull from either local device results in messages from Git stating:
Already up to date
for a pull and Everything up to date
for a push.
Problem! How to solve?
I wanted to model this after the way that pass works on UNIX/Linux workstations along with its counterpart combination of Password Store and OpenKeyChain works on Android. Basically, pass uses git to synchronize between my remote Gitea server's private repo and all I have to do when using either laptop or android is to pull down the settings menu and choose sync - voila! The device is now synchronized with the remote repo, and it works flawlessly everytime.
What am I doing wrong here? How can I solve this and gain the functionality that I'm seeking to harness?
I've never really had issues before using git with local and remote repos, but then again, with the exception of pass/Password Store/OpenKeyChain I've always worked with a team that included others and was never really all that concerned with doing a pull of my own updates from remote (because, by definition, I already had them) unless I was moving to a new device. I was getting everyone elses contribs as expected.