You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**git-remote-sqlite(1)** is a [Git protocol helper](https://git-scm.com/docs/gitremote-helpers) that helps you store a Git repository in a [SQLite](https://www.sqlite.org) database. Why would you want to do this?
7
+
**git-remote-sqlite** is a [Git protocol helper](https://git-scm.com/docs/gitremote-helpers) that helps you store a Git repository in a [SQLite](https://www.sqlite.org) database. Why would you want to do this?
10
8
11
-
1.**Simple Git hosting**. Hosting git repositories typically involves using a third-party forge like GitHub or Sourcehut. These provide value by automating hosting NFS mounts and providing a web interface for collaboration.
12
-
2.**Self-contained application bundle**. It serves as both a Git repository hosting alternative and enables Lisp/Smalltalk-style development images where code and its runtime state coexist.
13
-
3.**(Advanced) More control over automation**. Leveraging Git hooks lets you transactionally automate tasks like migrations.
14
-
4.**(Advanced) Build your own workflows**. An application can be built that is self-updating - you don't need to rely on pull-requests or emails etc. to update your application, you can easily build updating itself into your application.
9
+
1.**Simple Git hosting**. Hosting git repositories typically involves using a third-party forge like [GitHub](https://github.com) or [Sourcehut](https://sourcehut.org). These primarily provide value by handling the storage, networking, and access control complexity of hosting Git repositories. At a smaller scale, **git-remote-sqlite** (combined with other tools like [Litestream](https://litestream.io)) may be cheaper and practically easy enough to use.
10
+
2.**Self-contained application bundle**. While **git-remote-sqlite** isn't as powerful as Lisp/Smalltalk-style images, it does allow an application's data to be distributed alongside its code. What can you do with this? I don't know but it sounds cool!
11
+
3.**(Advanced) More control over workflows**. Leveraging Git hooks lets you transactionally automate code changes. Think Erlang/OTP's `code_change/3` but more generic.
These settings are stored in the `git_config` table and affect how git operations are processed when interacting with the SQLite repository.
81
+
## How it works
82
+
83
+
**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.
84
+
85
+
The [database schema](docs/schema.md) includes:
86
+
87
+
-`git_objects` - stores all Git objects with their SHA, type, and data
88
+
-`git_refs` - tracks branches and tags
89
+
-`git_symbolic_refs` - handles HEAD and other symbolic references
90
+
91
+
Since 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.
92
+
93
+
## FAQ
94
+
95
+
### Why not just use a bare Git repository?
96
+
97
+
Bare repos work great for traditional hosting, but SQLite gives you:
98
+
- Queryable data - find large objects, analyze commit patterns, or build
99
+
custom workflows with SQL
100
+
- Single-file deployment - one `.db` file instead of a directory tree
101
+
- Replication options - tools like Litestream can continuously replicate
102
+
SQLite to S3
103
+
104
+
### How does performance compare to regular Git?
105
+
106
+
For small-to-medium repositories, performance is comparable. The SQLite
107
+
overhead is minimal for most operations. However:
108
+
- Large repositories with thousands of objects may be slower
109
+
- Pack files aren't implemented yet, so storage is less efficient
110
+
- Clone operations might be slower than optimized Git servers
111
+
112
+
**git-remote-sqlite** is currently proitizing simplicity and trying new stuff over raw performance.
113
+
114
+
### Can I use this with existing Git workflows?
115
+
116
+
Yes! **git-remote-sqlite** is a standard Git remote helper. You can:
117
+
- Push/pull between SQLite and regular Git repos
118
+
- Use it alongside other remotes (GitHub, GitLab, etc.)
119
+
- Apply standard Git workflows (branches, merges, rebases)
120
+
121
+
### Is the database format stable?
122
+
123
+
The schema is documented in [docs/schema.md](docs/schema.md). While I may
124
+
add tables (like pack support), I'll try not to break existing tables without an automatic migration plan.
125
+
126
+
### What about security?
78
127
128
+
**git-remote-sqlite** provides no authentication or access control - it's
129
+
designed for local use or trusted environments. For remote access, you'd need
130
+
to add your own security layer or use SQLite's built-in encryption
0 commit comments