Single-file Git repos that can replicate with Litestream
Zig
123
16 commits
updated Jun 6, 2025
Latest release | Changes | Source
git-remote-sqlite is a Git protocol helper that helps you store a Git repository in a SQLite database. Why would you want to do this?
code_change/3 but more generic.Download and extract the latest release for your platform:
# macOS (Apple Silicon)
curl -L https://github.com/chrislloyd/git-remote-sqlite/releases/latest/download/git-remote-sqlite-aarch64-macos.tar.gz | tar xz
# Linux (x86_64)
curl -L https://github.com/chrislloyd/git-remote-sqlite/releases/latest/download/git-remote-sqlite-x86_64-linux.tar.gz | tar xz
Move the binary to your $PATH:
sudo mv git-remote-sqlite /usr/local/bin/
When git-remote-sqlite is in your $PATH, you can push your code to a local SQLite database. If it doesn't exist, it'll be created:
git push sqlite://myapp.db main
Pull it back:
git pull sqlite://myapp.db main
All done! Fancy.
You can configure server-side git settings. These don't currently affect any behavior.
# Set configuration variables (similar to editing server-side git config)
git-remote-sqlite config myapp.db receive.denyDeletes true
git-remote-sqlite config myapp.db receive.denyNonFastForwards true
# List all configured settings
git-remote-sqlite config myapp.db --list
# Get a specific setting value
git-remote-sqlite config myapp.db --get receive.denyDeletes
# Remove a setting
git-remote-sqlite config myapp.db --unset receive.denyDeletes
git-remote-sqlite stores Git objects (commits, trees, blobs) as rows in SQLite tables. When you push to sqlite://myapp.db, Git objects are inserted into the database. When you pull, they're read back out.
The database schema includes:
git_objects - stores all Git objects with their SHA, type, and datagit_refs - tracks branches and tagsgit_symbolic_refs - handles HEAD and other symbolic referencesSince it's just a SQLite database, you can query your repository with SQL, back it up with standard tools, or even replicate it with Litestream.
Bare repos work great for traditional hosting, but SQLite gives you:
.db file instead of a directory treeFor small-to-medium repositories, performance is comparable. The SQLite overhead is minimal for most operations. However:
git-remote-sqlite is currently proitizing simplicity and trying new stuff over raw performance.
Yes! git-remote-sqlite is a standard Git remote helper. You can:
The schema is documented in docs/schema.md. While I may add tables (like pack support), I'll try not to break existing tables without an automatic migration plan.
git-remote-sqlite provides no authentication or access control - it's designed for local use or trusted environments. For remote access, you'd need to add your own security layer or use SQLite's built-in encryption extensions.
Probably not. git-remote-sqlite is not 1.0 yet. It definitely has bugs, performance cliffs and unknown behavior that makes it unsuitable for anything other than disposable toys.
16 commits
Zig
93.2%
Shell
6.8%
Single-file Git repos that can replicate with Litestream
Zig
123
16 commits
updated Jun 6, 2025
Latest release | Changes | Source
git-remote-sqlite is a Git protocol helper that helps you store a Git repository in a SQLite database. Why would you want to do this?
code_change/3 but more generic.Download and extract the latest release for your platform:
# macOS (Apple Silicon)
curl -L https://github.com/chrislloyd/git-remote-sqlite/releases/latest/download/git-remote-sqlite-aarch64-macos.tar.gz | tar xz
# Linux (x86_64)
curl -L https://github.com/chrislloyd/git-remote-sqlite/releases/latest/download/git-remote-sqlite-x86_64-linux.tar.gz | tar xz
Move the binary to your $PATH:
sudo mv git-remote-sqlite /usr/local/bin/
When git-remote-sqlite is in your $PATH, you can push your code to a local SQLite database. If it doesn't exist, it'll be created:
git push sqlite://myapp.db main
Pull it back:
git pull sqlite://myapp.db main
All done! Fancy.
You can configure server-side git settings. These don't currently affect any behavior.
# Set configuration variables (similar to editing server-side git config)
git-remote-sqlite config myapp.db receive.denyDeletes true
git-remote-sqlite config myapp.db receive.denyNonFastForwards true
# List all configured settings
git-remote-sqlite config myapp.db --list
# Get a specific setting value
git-remote-sqlite config myapp.db --get receive.denyDeletes
# Remove a setting
git-remote-sqlite config myapp.db --unset receive.denyDeletes
git-remote-sqlite stores Git objects (commits, trees, blobs) as rows in SQLite tables. When you push to sqlite://myapp.db, Git objects are inserted into the database. When you pull, they're read back out.
The database schema includes:
git_objects - stores all Git objects with their SHA, type, and datagit_refs - tracks branches and tagsgit_symbolic_refs - handles HEAD and other symbolic referencesSince it's just a SQLite database, you can query your repository with SQL, back it up with standard tools, or even replicate it with Litestream.
Bare repos work great for traditional hosting, but SQLite gives you:
.db file instead of a directory treeFor small-to-medium repositories, performance is comparable. The SQLite overhead is minimal for most operations. However:
git-remote-sqlite is currently proitizing simplicity and trying new stuff over raw performance.
Yes! git-remote-sqlite is a standard Git remote helper. You can:
The schema is documented in docs/schema.md. While I may add tables (like pack support), I'll try not to break existing tables without an automatic migration plan.
git-remote-sqlite provides no authentication or access control - it's designed for local use or trusted environments. For remote access, you'd need to add your own security layer or use SQLite's built-in encryption extensions.
Probably not. git-remote-sqlite is not 1.0 yet. It definitely has bugs, performance cliffs and unknown behavior that makes it unsuitable for anything other than disposable toys.
16 commits
Zig
93.2%
Shell
6.8%