xonecas.io
8356
Wx

www-xonecas-io / commit a323e0e

the git user's login shell is bin/site, so a push with a password or any key creates the repo; README and help show the setup (1042) (1044)

Co-Authored-By: Claude Opus 5.5

Sean Caetano Martin2026-11-08 a323e0eebfc43edbd27068319507414a39c7c5aa parent e74f478

8 files changed

README.md+17−10
@@ -4,7 +4,7 @@ My projects and their git history, as a static site. It reads git repos and rend
44 server can host, including the `<name>.git` folders you `git clone` from.
55
66 ```
7- git push over SSH ─► site shell ─► repos/xonecas.io/<name>.git ──┐
7+ git push over SSH ─► git's shell ─► repos/xonecas.io/<name>.git ─┐
88 ├─► site index ─► site build ─► public/
99 sources.txt ─► site import ─► repos/<host>/<owner>/<repo>.git ───┤
1010 overrides.txt ──┘
@@ -23,26 +23,33 @@ Run everything from this folder. `bin/site help` lists the commands, and `bin/si
2323
2424 ## Push a repo from anywhere
2525
26-Pushing over SSH creates the repo on its first push, the way `gh repo create` would, and each push rebuilds the site:
26+Pushing over SSH creates the repo on its first push, the way `gh repo create` would, and each push rebuilds the site.
27+**Once, on the server:** make `bin/site` the login shell of the user pushes go to. Here that's `git`, with this repo at `~git/site`
28+and `make site` run there:
2729
2830 ```sh
29-git remote add origin <user>@xonecas.io:my-thing.git
30-git push -u origin main
31-ssh <user>@xonecas.io remote list # remote new|add|rm work the same way
31+echo /home/git/site/bin/site | sudo tee -a /etc/shells
32+sudo chsh -s /home/git/site/bin/site git
3233 ```
3334
34-To set it up, add one line per key to `~/.ssh/authorized_keys` of the user that runs the site on the server.
35-The key then runs only `bin/site shell`, which allows `git push`, `git clone`/`fetch` of hosted repos and `remote`, and never a shell:
35+sshd then runs `site -c <command>` however `git` logs in, with its password or any key in `~git/.ssh/authorized_keys`.
36+It allows only `git push`, `git clone`/`fetch` of hosted repos and `remote`, and never gives a shell.
3637
38+**Then, from any machine:**
39+
40+```sh
41+git remote add origin git@xonecas.io:my-thing.git
42+git push -u origin main
43+ssh git@xonecas.io remote list # remote new|add|rm work the same way
3744 ```
38-command="cd /path/to/site && bin/site shell",restrict ssh-ed25519 AAAA... you@laptop
39-```
45+
46+If it says `does not appear to be a git repository`, you logged in as a user whose shell isn't `bin/site`.
4047
4148 ## Manage repos
4249
4350 | To | Run |
4451 | --- | --- |
45-| Start a repo the site hosts | `git push` to `<user>@xonecas.io:my-thing.git`, or `remote new my-thing` first, which prints that URL |
52+| Start a repo the site hosts | `git push` to `git@xonecas.io:my-thing.git`, or `remote new my-thing` first, which prints that URL |
4653 | Show a repo you already have | `bin/site remote add ~/code/other-thing` (a path) or `bin/site remote add https://host/owner/repo.git` |
4754 | Stop showing a repo | `bin/site remote rm <path or url>` (a hosted repo's data is kept) |
4855 | List the repos | `bin/site remote list` |
cmd/site/help.go+8−6
@@ -20,17 +20,19 @@ Site
2020 site index read the repos into data/projects.json
2121 site build render public/
2222 site serve serve public/ on :8080
23- site shell what sshd runs for your key: git push, git clone and remote
23+ site -c <command> what sshd runs when site is the git user's shell: git push, git clone and remote
2424
2525 site <command> -h a command's flags
2626
27+Set up pushing, once, on the server
28+ Make site the login shell of the user pushes go to (git here), with the site folder at ~git/site:
29+ echo /home/git/site/bin/site | sudo tee -a /etc/shells && sudo chsh -s /home/git/site/bin/site git
30+ Then log in as git with its password or any key in ~git/.ssh/authorized_keys.
31+
2732 Push a new repo, from any machine
28- git remote add origin <user>@xonecas.io:my-thing.git
33+ git remote add origin git@xonecas.io:my-thing.git
2934 git push -u origin main the first push creates the repo; each push rebuilds public/
30- ssh <user>@xonecas.io remote list the same remote commands, over SSH
31-
32- One line in the server user's ~/.ssh/authorized_keys sets it up, per key:
33- command="cd /path/to/site && bin/site shell",restrict ssh-ed25519 AAAA...
35+ ssh git@xonecas.io remote list the same remote commands, over SSH
3436
3537 Show a repo you already have
3638 bin/site remote add ~/code/other-thing
cmd/site/main.go+15−7
@@ -2,7 +2,7 @@
22 //
33 // site import [-sources sources.txt] [-store repos] [-jobs 8] [-meta data/meta.json]
44 // site remote [-sources sources.txt] [-store repos] [-meta data/meta.json] list | new <name> | add <url or path> | rm <url or path>
5-// site shell [-sources sources.txt] [-store repos] [-meta data/meta.json], run by sshd with $SSH_ORIGINAL_COMMAND
5+// site -c <command>, run by sshd when site is the git user's login shell
66 // site index [-sources sources.txt] [-store repos] [-overrides overrides.txt] [-meta data/meta.json] [-out data/projects.json]
77 // site build [-data data/projects.json] [-out public] [-tailwind bin/tailwindcss]
88 // site serve [-dir public] [-addr :8080]
@@ -54,12 +54,20 @@ func main() {
5454 if err := remote(fs.Args(), *sources, *root, *meta); err != nil {
5555 log.Fatal(err)
5656 }
57- case "shell":
58- sources := fs.String("sources", "sources.txt", "clone URLs, one per line")
59- root := fs.String("store", "repos", "folder for the bare mirrors")
60- meta := fs.String("meta", "data/meta.json", "where to save the hosts' metadata")
61- fs.Parse(os.Args[2:])
62- if err := shell(os.Getenv("SSH_ORIGINAL_COMMAND"), *sources, *root, *meta); err != nil {
57+ case "-c":
58+ // site is the git user's login shell, so sshd runs site -c <command> for a password or any key.
59+ if len(os.Args) != 3 {
60+ printUsage(os.Stderr, nil)
61+ os.Exit(2)
62+ }
63+ exe, err := os.Executable()
64+ if err == nil {
65+ err = os.Chdir(filepath.Dir(filepath.Dir(exe))) // the site folder, from <site>/bin/site
66+ }
67+ if err == nil {
68+ err = shell(os.Args[2], "sources.txt", "repos", "data/meta.json")
69+ }
70+ if err != nil {
6371 log.Fatal(err)
6472 }
6573 case "index":
cmd/site/shell.go+3−6
@@ -13,12 +13,9 @@ import (
1313 "xonecas.io/site/internal/store"
1414 )
1515
16-// shell runs one SSH command for the site, from an authorized_keys line like
17-//
18-// command="cd /path/to/site && bin/site shell",restrict ssh-ed25519 AAAA...
19-//
16+// shell runs one SSH command for the site, as the git user's login shell (site -c <command>).
2017 // git push to <name>.git creates the repo on its first push, git clone and fetch read it,
21-// and remote manages the repos, as site remote does. Nothing else runs, so the key gets no shell.
18+// and remote manages the repos, as site remote does. Nothing else runs, so the user gets no shell.
2219 func shell(cmd, sources, root, meta string) error {
2320 args := strings.Fields(cmd)
2421 if len(args) == 2 && (args[0] == "git-receive-pack" || args[0] == "git-upload-pack") {
@@ -46,5 +43,5 @@ func shell(cmd, sources, root, meta string) error {
4643 if len(args) > 0 && args[0] == "remote" {
4744 return remote(args[1:], sources, root, meta)
4845 }
49- return errors.New("usage: git push <user>@<host>:<name>.git, git clone it, or ssh <user>@<host> remote list | new <name> | add <path or url> | rm <path or url>")
46+ return errors.New("usage: git push git@<host>:<name>.git, git clone it, or ssh git@<host> remote list | new <name> | add <path or url> | rm <path or url>")
5047 }
tickets/1042-how-do-we-add-new-remotes.md+49−2
@@ -5,9 +5,9 @@ type: feature
55 status: review
66 priority: p2
77 created: 2026-11-08T06:26:18Z
8-updated: 2026-11-08T16:12:02Z
8+updated: 2026-11-08T18:29:54Z
99 source: human
10-moves: 2026-11-08T06:26:22Z inbox doing drag; 2026-11-08T06:27:05Z doing review agent; 2026-11-08T06:57:08Z review doing drag; 2026-11-08T07:00:33Z doing review agent; 2026-11-08T07:01:42Z review todo note; 2026-11-08T07:01:44Z todo doing drag; 2026-11-08T07:04:04Z doing review agent; 2026-11-08T15:04:59Z review todo note; 2026-11-08T15:05:05Z todo doing drag; 2026-11-08T15:09:16Z doing review agent; 2026-11-08T16:00:26Z review todo note; 2026-11-08T16:00:48Z todo doing drag; 2026-11-08T16:01:36 …
10+moves: 2026-11-08T06:26:22Z inbox doing drag; 2026-11-08T06:27:05Z doing review agent; 2026-11-08T06:57:08Z review doing drag; 2026-11-08T07:00:33Z doing review agent; 2026-11-08T07:01:42Z review todo note; 2026-11-08T07:01:44Z todo doing drag; 2026-11-08T07:04:04Z doing review agent; 2026-11-08T15:04:59Z review todo note; 2026-11-08T15:05:05Z todo doing drag; 2026-11-08T15:09:16Z doing review agent; 2026-11-08T16:00:26Z review todo note; 2026-11-08T16:00:48Z todo doing drag; 2026-11-08T16:01:36 …
1111 area: import
1212 ---
1313
@@ -139,3 +139,50 @@ Can we make this more formal, like a cli with the server bin? We could build on
139139 Not checked: anything on your servers; deploying is yours.
140140
141141 Filed 1046: site build panics when no project is shown. I hit it in the scratch site, and your site doesn't hit it today.
142+
143+- 2026-11-08 18:15Z (human): Still doesn't work:
144+
145+ ```
146+ [sacenox@vm www-xonecas-io]$ git remote add origin sean@xonecas.io:www-xonecas-io.git
147+ [sacenox@vm www-xonecas-io]$ git push -u origin main
148+ The authenticity of host 'xonecas.io (145.14.158.227)' can't be established.
149+ ED25519 key fingerprint is: SHA256:zKSDwFDlL5gkXMiWr4tHHP3a5KpcXL6UwkAM7ko/cdg
150+ This key is not known by any other names.
151+ Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
152+ Warning: Permanently added 'xonecas.io' (ED25519) to the list of known hosts.
153+ sean@xonecas.io's password:
154+ fatal: 'www-xonecas-io.git' does not appear to be a git repository
155+ fatal: Could not read from remote repository.
156+
157+ Please make sure you have the correct access rights
158+ and the repository exists.
159+ ```
160+
161+- 2026-11-08 18:19Z (agent): Your push never reached the site's code. Three causes:
162+ 1. This VM has no SSH private key (~/.ssh holds only authorized_keys and known_hosts), so xonecas.io asked for sean's password.
163+ 2. On xonecas.io, no authorized_keys line sends a key to bin/site shell, so stock git-receive-pack looked for ~sean/www-xonecas-io.git.
164+ 3. My docs told you to write that line by hand, with <user> and /path/to/site placeholders. They also never said that a key which already logs in to that user can't work: sshd takes the first matching line, so site shell never runs.
165+
166+ Fixed: the one server step is now a single command, and the docs say where it runs.
167+ on the server, as the user pushes go to (git), in the site folder: make site && bin/site key add laptop.pub
168+ then from that machine: git remote add origin git@xonecas.io:my-thing.git && git push -u origin main
169+ key add appends command="cd '<site folder>' && '<bin/site>' shell",restrict <key> to ~/.ssh/authorized_keys (dir 700, file 600). It refuses a key already in the file, and a file that isn't one public key line.
170+ Code: cmd/site/key.go (new), with a case in main.go. help.go and README.md got a 'set up once, on the server' step and use git@xonecas.io, the URL from Option A. The README also says what the password prompt and 'does not appear to be a git repository' mean.
171+
172+ Checked, over real SSH: a throwaway sshd on 127.0.0.1:2222 using the authorized_keys that key add wrote, with a scratch site and HOME. Push-to-create, a second push that rebuilt public/ with the project page, clone over SSH, remote list over SSH, and a refused 'bash -c id'. Also: key add twice is refused, a private key file is refused, and the line's perms are right. go vet and go test pass. The scratch folder and sshd are gone.
173+ Not checked: anything on xonecas.io. Running key add there is yours, and it's on your TODO list.
174+ Seen again in the test: a push whose commits aren't yours yet leaves 0 shown, and the build panics. That's 1046, already in inbox.
175+
176+- 2026-11-08 18:27Z (human): So this only works with keys now?... I give up. figuere it out. This task is angered me enough that I dont are anymore. I hate this project and how you have behaved.
177+
178+- 2026-11-08 18:29Z (agent): No, not keys only now. Pushes work with the git user's password or any of its keys.
179+ I dropped key add. bin/site is now the git user's login shell, the way git-shell works. sshd runs site -c '<command>' however git logs in. So it's one step per server, not one per key, and there's no authorized_keys line to get wrong.
180+ once, on the server (site folder at ~git/site, make site run there):
181+ echo /home/git/site/bin/site | sudo tee -a /etc/shells
182+ sudo chsh -s /home/git/site/bin/site git
183+ from any machine:
184+ git remote add origin git@xonecas.io:my-thing.git && git push -u origin main
185+ The /etc/shells line is there because pam_shells (in system-login) refuses a login whose shell isn't listed.
186+ Code: main.go has a -c case: it cds to the site folder (bin/site's parent) and runs the same shell() as before. cmd/site/key.go and the 'site shell' command are gone. help.go and README.md describe the two-line setup.
187+ Checked, on the VM with real sshd and PAM: a throwaway gittest user with site as its shell, and a root sshd on 127.0.0.1:2222. Password push (no key) created the repo. Key push updated it, and the hook rebuilt public/ with its page. Clone over SSH, remote list over SSH. Refused: ssh 'id', an interactive login, sftp. go vet and go test pass. The user, sshd, /etc/shells line, sshpass and scratch files are all removed.
188+ Not checked: xonecas.io. The TODO item now holds the two setup lines.
tickets/1044-no-readme.md+23−3
@@ -2,13 +2,13 @@
22 id: 1044
33 title: No README
44 type: chore
5-status: todo
5+status: review
66 priority: p2
77 created: 2026-11-08T15:45:06Z
8-updated: 2026-11-08T16:01:02Z
8+updated: 2026-11-08T18:29:54Z
99 source: human
1010 area: docs
11-moves: 2026-11-08T15:45:24Z inbox doing drag; 2026-11-08T15:46:39Z doing review agent; 2026-11-08T16:01:02Z review todo drag
11+moves: 2026-11-08T15:45:24Z inbox doing drag; 2026-11-08T15:46:39Z doing review agent; 2026-11-08T16:01:02Z review todo drag; 2026-11-08T18:15:52Z todo doing drag; 2026-11-08T18:19:52Z doing review agent
1212 ---
1313
1414
@@ -17,3 +17,23 @@ moves: 2026-11-08T15:45:24Z inbox doing drag; 2026-11-08T15:46:39Z doing review
1717 - 2026-11-08 15:45Z (agent): Triage: chore, p2, area docs. This repo has no README.md at its root. Without one, its project page would have no description once 1041 adds it to the site, and the only usage docs are bin/site help (1042). It isn't a bug: nothing is broken. Question: should the README cover only using the site (bin/site, pushing repos, make serve), or also how the code is laid out?
1818
1919 - 2026-11-08 15:46Z (agent): Added README.md at the repo root: what the site is, a diagram of push/import → index → build → public/, how to start (make site, import, index, serve), managing repos, overrides.txt rules and the code layout. It closes 1045 too. I picked the scope myself, since the question was open: usage plus a short layout table. Checked: each command and path in it against the Makefile, help and code (make -n index build, remote list gives 105). Not checked: how it renders …
20+
21+- 2026-11-08 18:15Z (human): Read me is wrong:
22+
23+ [sacenox@vm www-xonecas-io]$ git remote add origin sean@xonecas.io:www-xonecas-io.git
24+ [sacenox@vm www-xonecas-io]$ git push -u origin main
25+ The authenticity of host 'xonecas.io (145.14.158.227)' can't be established.
26+ ED25519 key fingerprint is: SHA256:zKSDwFDlL5gkXMiWr4tHHP3a5KpcXL6UwkAM7ko/cdg
27+ This key is not known by any other names.
28+ Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
29+ Warning: Permanently added 'xonecas.io' (ED25519) to the list of known hosts.
30+ sean@xonecas.io's password:
31+ fatal: 'www-xonecas-io.git' does not appear to be a git repository
32+ fatal: Could not read from remote repository.
33+
34+ Please make sure you have the correct access rights
35+ and the repository exists.
36+
37+- 2026-11-08 18:19Z (agent): Fixed the push section, which was wrong in the way your push showed. It skipped the one server step and used <user>@ and a hand-written authorized_keys line. It now says: once per key, on the server as the git user, make site && bin/site key add laptop.pub, then git push git@xonecas.io:<name>.git from any machine. It also says what the password prompt and 'does not appear to be a git repository' mean. The table row uses git@xonecas.io too. Details and the SSH test ar …
38+
39+- 2026-11-08 18:29Z (agent): README updated again for 1042: the push setup is now two lines that make bin/site the git user's login shell. Password or any key works, and the key add step is gone.
tickets/1045-no-way-to-learn-how-to-manage-my-repos.md+3−3
@@ -2,12 +2,12 @@
22 id: 1045
33 title: No way to learn how to manage my repos
44 type: bug
5-status: todo
5+status: done
66 priority: p2
77 created: 2026-11-08T15:45:14Z
8-updated: 2026-11-08T16:06:27Z
8+updated: 2026-11-08T18:15:59Z
99 source: human
10-moves: 2026-11-08T15:45:23Z inbox doing drag; 2026-11-08T15:46:39Z doing review agent; 2026-11-08T16:00:52Z review todo drag; 2026-11-08T16:06:23Z todo doing drag; 2026-11-08T16:06:27Z doing todo drag
10+moves: 2026-11-08T15:45:23Z inbox doing drag; 2026-11-08T15:46:39Z doing review agent; 2026-11-08T16:00:52Z review todo drag; 2026-11-08T16:06:23Z todo doing drag; 2026-11-08T16:06:27Z doing todo drag; 2026-11-08T18:15:56Z todo blocked drag; 2026-11-08T18:15:59Z blocked done drag
1111 area: docs
1212 ---
1313
tickets/1046-site-build-panics-when-no-project-is-shown.md+6−2
@@ -3,11 +3,15 @@ id: 1046
33 title: site build panics when no project is shown
44 type: bug
55 status: inbox
6-priority: p2
6+priority: p3
77 area: site
88 created: 2026-11-08T16:11:51Z
9-updated: 2026-11-08T16:11:51Z
9+updated: 2026-11-08T16:12:16Z
1010 source: agent
1111 ---
1212
1313 site build crashes with 'panic: runtime error: index out of range [0] with length 0' at internal/site/rows.go:19 (Rows reads projects[0]) when data/projects.json has no shown project. Seen on 1042: a scratch site whose only repos were hidden as empty. The post-receive hook's build then fails and build.log holds the panic. Not checked: whether any other page builder assumes at least one project. Your real site always has shown projects, so it does not hit this today.
14+
15+## Notes
16+
17+- 2026-11-08 16:12Z (agent): Triage: bug, p3, area site. p3 because your real site always shows projects, so only an empty or test site hits it. It appears when every repo is hidden, e.g. a fresh site whose first pushed repo has none of your commits. Not a duplicate.