aimb-x/gitd
repositories / aimb-x / gitd

gitd public

git clone https://git.169.58.159.131.nip.io/aimb-x/gitd.git
README.md 3560 bytes 1 lines
1
# gitd
2
3
Our own git server — the "GitHub" that is actually ours. Plain `git clone`, `git push`
4
and `git fetch` work because gitd speaks the real smart-HTTP protocol; accounts,
5
tokens and repository metadata live in [kilat](../kilat), our own storage engine.
6
7
- UI: <https://git.169.58.159.131.nip.io/>
8
- Protocol: `https://git.169.58.159.131.nip.io/<owner>/<repo>.git`
9
- Stack: Python 3.14 stdlib + git plumbing. No Gitea, no Gogs, no Node.
10
11
## Protocol surface
12
13
gitd implements exactly the four endpoints a git client needs:
14
15
```
16
GET /<owner>/<repo>.git/info/refs?service=git-upload-pack|git-receive-pack
17
POST /<owner>/<repo>.git/git-upload-pack
18
POST /<owner>/<repo>.git/git-receive-pack
19
```
20
21
- **Advertisement** — runs `git upload-pack --stateless-rpc --advertise-refs` (or
22
`receive-pack`) and wraps the output in a pkt-line `# service=…` header, so an
23
unmodified client sees a normal server.
24
- **RPC** — streams the client body into `git … --stateless-rpc` and returns the pack
25
with `application/x-git-…-result`. `Git-Protocol` (v2) is passed through.
26
- **Create on first push** — a missing repository is `git init --bare`d when the
27
authenticated owner pushes to it, and its HEAD is pointed at the branch that actually
28
exists (a bare repo defaults to `master`, which otherwise makes `git clone` check out
29
nothing).
30
- **Auth** — HTTP Basic, any username, password = an `ag_usr_…` token (the same token
31
agentgit issues). `Bearer` and `?token=` work for the web UI. Public repositories are
32
readable anonymously; writes always require the owner's token.
33
34
## Measured on this machine
35
36
| | |
37
|---|---|
38
| repositories hosted | 3 (agentgit 224 KB, kilat, gitd) |
39
| clone (agentgit, anonymous, `--depth 1`) | **0.21 s** |
40
| push (new commit over HTTPS) | **0.24 s** |
41
| tests | **8 passing** — real `git push` / `git clone` against an in-process server |
42
| metadata file | **2.8 KB** for 3 repos + 2 users |
43
44
## UI
45
46
GitHub-shaped, AIMB-X colours, no framework: repository cards with visibility badges,
47
per-repo page with branch selector, last 12 commits, file tree and a line-numbered blob
48
viewer, plus `/about`.
49
50
## Running
51
52
```bash
53
make deploy # rsync to /opt/gitd + restart gitd.service
54
gitd user aimb-x # owner + token (shown once)
55
gitd import-users /var/lib/agentgit/agentgit.kilat # reuse agentgit tokens
56
gitd serve --host 127.0.0.1 --port 8189
57
```
58
59
Push:
60
61
```bash
62
git remote add origin https://git.169.58.159.131.nip.io/aimb-x/agentgit.git
63
GIT_ASKPASS=... git push origin main # username: anything, password: ag_usr_…
64
```
65
66
Metadata writes that must be visible to a *running* server go through
67
`POST /admin/repo` (admin token). kilat is single-writer, so a CLI change to the same
68
file would be invisible until restart — the admin endpoint keeps one writer.
69
70
## Limits, stated plainly
71
72
- **One process** — no horizontal scaling, no per-repo quotas, no idle timeouts.
73
- **Metadata is ours, history is git's** — objects live in normal bare repositories;
74
kilat only stores owners, visibility and descriptions.
75
- **No pull requests, issues, webhooks, LFS, tags UI, or code search.** Branches and
76
blobs are read-only in the UI; everything else is `git` itself.
77
- **Push body buffered in memory** up to `GITD_MAX_BODY` (default 512 MB).
78
- **No attribution yet** — the server trusts `REMOTE_USER` for the audit trail but does
79
not verify commit authorship.
80
81
It is a git remote with a readable face, on our own storage — not a GitHub clone in
82
features, and not trying to be.