A small C++ daemon that auto-pushes config changes to git. It watches a list of
local git repos, checks every interval for changes, and if any are found runs
git add -A → git commit → git push.
The binary is statically linked, so the only runtime dependency is git itself.
Requirements: a C++23 compiler and CMake.
- Arch:
sudo pacman -S base-devel cmake - Debian/Ubuntu:
sudo apt install build-essential cmake
git clone <repo-url> configsync
cd configsync
cmake -B build && cmake --build buildThe binary is at build/configsync.
The daemon reads ~/.config/configsync/config.toml:
interval = "5m" # also: 30s, 1h, 2d, or a plain int = seconds
commit_message = "auto: config sync {timestamp}"
push = true
user_name = "nico" # optional; passed via git -c, else gitconfig
user_email = "nico@example.com" # optional
repos = [
{ path = "~/.config/fish" },
{ path = "~/dotfiles" },
]| Key | Required | Default | Notes |
|---|---|---|---|
interval |
yes | — | plain int = seconds, or a number with s/m/h/d |
commit_message |
no | "auto: config sync {timestamp}" |
{timestamp} is replaced with the current time, e.g. 2026-08-23 14:05 |
push |
no | true |
if false, commits stay local |
user_name / user_email |
no | gitconfig | commit identity, passed via git -c when set |
repos |
yes | — | array of { path = "..." }; ~ is expanded; each folder must be its own git repo |
The file is re-read every cycle, so it can be edited live without a restart. A malformed file logs an error and the last good config keeps being used.
./build/configsyncOptionally pass a config path to override the default:
./build/configsync /path/to/some/config.tomlLogs go to stderr as [YYYY-MM-DD HH:MM:SS] LEVEL: message. Ctrl-C (SIGINT)
or SIGTERM stops the daemon cleanly.
cmake --install build --prefix "$HOME/.local"
install -Dm644 systemd/configsync.service "$HOME/.config/systemd/user/configsync.service"
systemctl --user daemon-reload
systemctl --user enable --now configsyncUseful commands:
systemctl --user status configsync
journalctl --user -u configsync -f # follow the logs
systemctl --user stop configsyncTo keep the service running after you log out (so it actually syncs in the background), enable lingering for your user:
sudo loginctl enable-linger "$USER"For each repo in the config, every interval:
git status --porcelain— empty output means nothing changed; the repo is skipped (one cheap subprocess, no file hashing).git add -A—-Aso deletions get synced too.git commit -m "<message>"with{timestamp}substituted.- If
push = true:git push. On failure an ERROR is logged and the daemon continues — there is no automatic pull/rebase; the commit stays in local history and the push is retried implicitly on the next cycle.
A path that is missing or not a git repo logs a WARN and is skipped; the daemon keeps running.
configsync/
├── CMakeLists.txt
├── src/
│ ├── main.cpp # main loop, signal handling, logging
│ ├── config.cpp/.hpp # TOML parsing, interval parsing, ~ expansion
│ └── git.cpp/.hpp # git command runner (fork/exec, captures stdout)
├── .vscode/
│ └── tasks.json # overseer.nvim / VS Code build task
├── third_party/toml.hpp # toml++ single header (MIT)
└── systemd/configsync.service