.gitbay/wiki/Users.org

4a511e42574ead9c92dc73fd320f296cc4dbea07
gitbay/.gitbay/wiki/Users.org

1193 lines · 60213 bytes

22 symbols in this file
   1#+title: gitbay user guide
   2
   3Everything here works from stock OpenSSH — replace =gitbay= with
   4=ssh git@<host>= in any command. The CLI adds convenience (instance
   5profiles, repo inference, =$EDITOR=), nothing more. Two things differ
   6over bare ssh:
   7
   8- ssh joins its arguments with spaces and the server tokenizes the
   9  result, so a value with a space in it needs a second layer of quotes:
  10  =--description "'a widget'"=, not =--description "a widget"=, which
  11  arrives as two arguments.
  12- =--help= is not understood. =ssh git@<host> help= lists every command
  13  the server knows, and =help <noun>= (=help repo=, =help mr=) prints
  14  the usage of each command under that noun.
  15
  16* Installing the CLI
  17
  18#+begin_src sh
  19go install gitbay.org/gitbay/cmd/gitbay@latest   # any platform with Go
  20
  21brew tap krz/tap https://gitbay.org/krz/homebrew-tap.git
  22brew install krz/tap/gitbay                      # Homebrew (macOS/Linux)
  23#+end_src
  24
  25Or build from source: =go build ./cmd/gitbay= in a clone of
  26=https://gitbay.org/krz/gitbay.git=.
  27
  28* Getting an account
  29
  30How you join depends on the instance's registration mode. On instances
  31with web accounts enabled, =/register= offers the same signup as a
  32browser form (paste your SSH public key); everything below works from
  33the terminal alone:
  34
  35- closed :: an admin creates your account on the host and registers your
  36  first SSH key. Nothing for you to do but hand over your public key.
  37- invite :: you receive a single-use code by email. With the SSH key you
  38  want to use:
  39  #+begin_src sh
  40  ssh git@<host> register --username you --invite <code>
  41  #+end_src
  42  Your account is active immediately; the invited address is your
  43  verified email.
  44- open ::
  45  #+begin_src sh
  46  ssh git@<host> register --username you --email you@example.org
  47  #+end_src
  48  A verification code arrives by mail. Until you run
  49  =ssh git@<host> email verify <code>=, the account is pending: you can
  50  run =whoami= and the email commands, and nothing else — no git, no
  51  repos.
  52
  53* SSH keys
  54
  55New to SSH keys? [[SSH-keys]] makes one in two commands.
  56
  57Your key is your identity; there are no passwords anywhere. The SSH
  58username is always =git= — the key alone determines who you are.
  59
  60#+begin_src sh
  61gitbay auth keys list
  62gitbay auth keys add --scope git < ~/.ssh/ci_key.pub   # key on stdin
  63gitbay auth keys add --label laptop < ~/.ssh/id_ed25519.pub
  64gitbay auth keys add --scope git --ttl 90d < ~/.ssh/ci_key.pub
  65gitbay auth keys label SHA256:... "work laptop"
  66gitbay auth keys remove SHA256:...
  67#+end_src
  68
  69A key's label is the comment on its =authorized_keys= line unless
  70=--label= gives one; =keys label= renames a key, and with no text
  71clears the name. Labels are one line of up to 64 bytes.
  72
  73=--ttl 90d= (or any Go duration, =720h=) makes a key stop
  74authenticating after that long; =repo deploy-key add= takes the same
  75flag. An expiring key cannot create credentials: tokens, keys, login
  76links. =keys list= shows when each key was last used and when it
  77expires, so a key nobody uses is easy to spot.
  78
  79Removing a key closes every connection it opened, including the CLI's
  80shared one; removing the key the current command runs on ends that
  81command's connection too.
  82
  83Scopes: =full= (default; git plus every control command), =git= (git
  84transport only — right for automation keys, which then cannot touch
  85issues, settings, or your account), or =runner= (the CI runner's
  86protocol plus read-only git, for the key a =gitbay-runner= host holds;
  87see [[Admin]]).
  88
  89A key belongs to exactly one account instance-wide. Registering a key
  90someone else already holds is refused without telling you whose it is.
  91
  92* Verified commits
  93
  94The commit badge is driven by the *author* email and the signing key:
  95=verified= means the signature is valid, the key is registered to an
  96account, and the author email is a verified address on that account.
  97
  98For OpenPGP signing (git's default):
  99#+begin_src sh
 100gpg --armor --export you@example.org | gitbay auth pgp add
 101#+end_src
 102
 103For SSH signing (=git config gpg.format ssh=): sign with any key
 104registered on your account; your verified addresses act as the principal
 105set. No separate registration step.
 106
 107Add and verify additional addresses with =email add <address>= /
 108=email verify <code>= (requires the instance to have SMTP; otherwise an
 109admin can assert an address for you). =email list= shows them. =email
 110remove <address>= drops one, with two refusals: the primary stays until
 111=email primary <address>= names another verified address, and the last
 112verified address stays, since activation, login links and commit
 113identity all resolve through verified addresses. Removing a verified
 114address re-evaluates signature states, so a commit authored from it
 115shows as =signed_email_mismatch= afterwards. A removed address is free
 116for any account to claim.
 117
 118The states you will see, in decreasing order of trust: =verified=,
 119=signed_unknown_key= (valid signature, key not registered here — register
 120it and history upgrades retroactively), =signed_email_mismatch= (real
 121key, author line claims someone else), =signed_key_expired= /
 122=signed_key_revoked=, =bad_signature=, =unsigned=. Server-created commits
 123(web edits, merge commits) are always =unsigned= — the server holds no
 124signing key on principle.
 125
 126=repo bookmark <owner/name>= saves a repository to come back to and
 127=repo unbookmark= drops it; =repo bookmarks= lists yours, each with how
 128many people have bookmarked it. The web has the control on the
 129repository header, the count in the facts bar, and the list at
 130=/bookmarks=. Bookmarks are public and counted; pins are private and
 131drive the rail. Read access is all a bookmark needs.
 132
 133A job's result is a property of the commit's *tree*, not its sha: a
 134rebase onto a base that touched nothing the branch did gives every
 135commit a new sha and the same tree, and a job that already passed for
 136that tree is not run again — the new commit gets the earlier result as
 137its =ci/<job>= status, naming the build it came from. Scheduled and tag
 138jobs are never reused this way; their trigger is the clock or the tag.
 139
 140* Profiles
 141
 142A profile is what =/{owner}= shows: a one-line description, a website, a
 143set of links, long-form about text, the repositories you can see, org
 144membership, and a year of activity. Users and orgs have the same fields.
 145Repository rows carry the listing metadata too — topics, license,
 146default branch, last commit — so a client renders a profile listing the
 147way =/{owner}= does. The web dispatches this command rather than
 148assembling the page itself.
 149
 150#+begin_src sh
 151gitbay profile show               # your own
 152gitbay profile show alice
 153gitbay profile set --description "builds small tools" --website https://alice.example
 154#+end_src
 155
 156The about text is not a field. It is =profile/README.md= or
 157=profile/README.org= on the default branch of =<owner>/.gitbay=, a
 158repository you own like any other, written by a push or by
 159=repo commit-file=:
 160
 161#+begin_src sh
 162gitbay repo create alice/.gitbay
 163gitbay repo commit-file alice/.gitbay profile/README.org \
 164       --ref main --file - < about.org
 165#+end_src
 166
 167The extension picks the renderer; =.md=, =.org= and =.markdown= are
 168resolved in that order, so a =README.md= beside a =README.org= wins.
 169=profile show= reports the text as =about=, its format as
 170=about_format=, and the file it came from as =about_path=.
 171
 172Access follows the repository: a private =.gitbay= keeps the about text
 173to you and the admins. A repository whose name starts with a dot is
 174infrastructure rather than a project, so it stays out of =explore= and
 175off the profile's repository list — =repo list= still shows it, and it
 176is reachable at its own URL.
 177
 178Up to five links, each =label|url= or a bare url, http(s) only. Passing
 179=--link= replaces the whole set; a single empty one clears it:
 180
 181#+begin_src sh
 182gitbay profile set --link "Mastodon|https://fosstodon.example/@alice" \
 183                   --link https://alice.example/now
 184gitbay profile set --link ""      # clear
 185#+end_src
 186
 187Every field follows the same rule as the rest of the CLI: a flag you
 188leave out is untouched, and ='' clears the one you name. Org profiles
 189work the same way and need org admin:
 190
 191#+begin_src sh
 192gitbay org profile krz --description "software and experiments"
 193gitbay org profile krz            # no flags shows it
 194#+end_src
 195
 196An org's about text works the same way, in =<org>/.gitbay=.
 197
 198The settings page edits description, website and links, and points at the
 199about file — with a button that creates =<owner>/.gitbay= and its first
 200README when you have none, so the file editor has a branch to open. The
 201JSON API runs =profile set= like any other write command.
 202
 203* Repositories
 204
 205#+begin_src sh
 206gitbay repo create you/project [--private]
 207gitbay repo clone you/project
 208gitbay repo list
 209gitbay repo show you/project
 210gitbay repo log you/project --limit 20      # commits with signature states
 211gitbay repo fork other/project [--name mine]
 212gitbay repo rename you/project tool          # clone URLs change
 213gitbay repo delete you/project --yes
 214#+end_src
 215
 216=repo show= also reports your own state on the repository — =watch=
 217(=watching= or =muted=; =repo unwatch= clears either) and =bookmarked= —
 218and =fork_of= when it is a
 219fork whose parent you can read, so a client draws a toggle rather than
 220two blind buttons. Absent means none.
 221
 222On the web, the repository's settings page carries access, webhooks,
 223rename, transfer and delete, and =/new= imports from a remote. Delete and
 224transfer ask for the repository's path to be typed. Large imports belong
 225on the CLI, where progress is visible.
 226
 227Pushing is SSH-only. Public repositories are anonymously readable over
 228HTTPS (and =git://= where enabled); private repositories exist only over
 229SSH and answer "not found" to everyone without access.
 230
 231Access and settings (owner or =admin= grant):
 232#+begin_src sh
 233gitbay repo access grant you/project alice write    # read | write | admin
 234gitbay repo access revoke you/project alice
 235gitbay repo access list you/project                 # everyone who can reach it, role, and via what
 236gitbay repo settings protect you/project main       # no force-push, no delete
 237gitbay repo settings require-mr you/project on      # protected branches: merge requests only
 238gitbay repo settings protect-tag you/project 'v*'   # matching tags: created once, never moved or deleted
 239gitbay repo settings default-branch you/project trunk # HEAD, and what the web shows
 240gitbay repo settings require-signed you/project on  # every commit must verify
 241gitbay repo settings secret-scan you/project block  # off | warn (default) | block
 242gitbay repo settings secret-scan-allow you/project 'testdata/**'  # paths whose findings are ignored
 243gitbay repo secret-scan you/project                 # scan the whole history
 244gitbay repo security enable you/project             # scheduled code scan, where the instance offers one
 245gitbay repo security status you/project             # its findings, also kept in an issue
 246gitbay repo deps status you/project                 # dependency updates and advisories
 247gitbay repo deps dismiss you/project GO-2026-5932 --reason not-affected  # or wont-fix, dev-only
 248gitbay repo deps reopen you/project GO-2026-5932
 249gitbay repo security dismiss you/project 3f9a0c1d2e --reason false-positive  # or wont-fix, test
 250gitbay repo security reopen you/project 3f9a0c1d2e
 251gitbay repo settings security-ignore you/project 'testdata/**'  # paths set aside from the scan
 252gitbay repo settings security-exclude-rule you/project swift.lang.crypto.insecure-random
 253gitbay repo settings security-frequency you/project weekly  # daily, weekly or monthly, as the instance allows
 254gitbay repo settings git-daemon you/project on      # expose over git://
 255gitbay repo topics add you/project cli forge        # free-form tags, shown on the web
 256gitbay repo search forge                            # find repos by name/description/topic
 257gitbay repo grep you/project "some string"          # literal git grep over the default branch
 258gitbay repo symbols you/project Dispatch            # where a name is defined, from the symbol index
 259gitbay repo pin you/project                         # pin to your web dashboard
 260gitbay repo unpin you/project
 261gitbay repo archive you/project                     # read-only: pushes and issue/MR
 262gitbay repo unarchive you/project                   #   writes refused, browsing intact
 263#+end_src
 264
 265Every push is scanned for credentials in formats that identify
 266themselves: private key blocks, cloud and forge tokens with a vendor
 267prefix (AWS, GitHub, GitLab, gitbay, Slack, Stripe, Google, npm, PyPI,
 268OpenAI, Anthropic, SendGrid, DigitalOcean, Shopify), and age secret
 269keys. The pre-receive hook reads the files the push adds or changes
 270and reports the commit, path, line and kind of each match, never the
 271value. Under =warn=, the default, the push is accepted and the pusher
 272sees where; the finding is recorded in the audit log. Under =block= the
 273push is refused, and so is a push the scan could not complete. A scan
 274reads at most 64 MiB, skips files over 1 MiB and binary files, and
 275stops after 90 seconds; a scan cut short says so. Merge commits are not
 276diffed. Content that does not pass through a push — =repo import=, pull
 277mirrors, the web editor, applied suggestions — is covered only by
 278=repo secret-scan=, which an admin runs over every ref.
 279
 280A push to the default branch queues a symbol index of its tree, built in
 281the background after the push completes; a tree that is already indexed
 282is not indexed again. =repo symbols <owner/name> [--kind k] <query>=
 283lists definitions whose name starts with the query (two characters
 284at least), exact matches
 285first, case-sensitive before case-insensitive, as name, kind, path and
 286line; =--limit= and =--cursor= page it, and without them it stops at
 287200 rows. A Go method is listed as =Type.Method= and also matches on
 288=Method=. Only the default branch is indexed: =--ref= accepts another
 289ref only when its tree is the indexed one. The index follows read
 290access: a repository you cannot read has no symbols either.
 291
 292=repo definitions <owner/name> <path>= goes the other way: for each
 293name the file uses that the index defines, the first definition and how
 294many there are. It is what the blob page links names from, for a client
 295that draws the file itself.
 296
 297What is indexed:
 298
 299| language                       | kinds                                                     |
 300|--------------------------------+-----------------------------------------------------------|
 301| Go (parsed)                    | function, method, type, const, var                        |
 302| Swift                          | function, class, struct, enum, interface (protocol), type |
 303| Rust                           | function, struct, enum, interface (trait), type, module, const, macro |
 304| Python                         | function, method, class                                   |
 305| JavaScript, TypeScript         | function, class, interface, type, enum, const             |
 306| C and C++ headers (=.h=, =.hpp=) | function (prototype), struct, enum, class, type, macro  |
 307| shell (=.sh=, =.bash=, =.zsh=) | function                                                  |
 308| org, Markdown                  | section (a heading)                                       |
 309
 310Languages other than Go are matched a line at a time, so unusual
 311definition shapes are missed. Files over 1 MiB, anything under
 312=vendor/= or =node_modules/=, =*_gen.go=, =*.pb.go=, Go files marked
 313=Code generated ... DO NOT EDIT.=, and =*.min.js= are skipped, and a
 314name longer than 256 bytes is dropped. One run stops at 200,000
 315symbols, 32 MiB of names and paths, or two minutes, and publishes what
 316it found as a partial index that says which bound it reached.
 317
 318A new index is written while the previous one stays in use, and
 319replaces it in one step. A run that cannot build an index records why
 320and leaves the previous index current; the same tree is tried again
 321once after an hour, or when a push changes the tree. A repository that
 322has not been pushed to since the index existed has none until its next
 323push to the default branch. =admin symbols reindex <owner/name>=
 324rebuilds one regardless.
 325
 326On the web, a file viewed at the indexed tree (the default branch's
 327head, or any commit with the same tree) links each name the index
 328holds: to its definition when there is one, to the results page at
 329=/{owner}/{repo}/symbols?q=<name>= when there are several. The file's
 330own definitions are listed above its source.
 331
 332Import from another forge — git data first, then optionally the issue
 333and PR history from GitHub or any Forgejo instance such as Codeberg
 334(issues keep state/labels/comments; PRs land as closed or merged MRs
 335with their discussion; originals are attributed inline since foreign
 336authors have no local account; re-running resumes where it stopped):
 337#+begin_src sh
 338gitbay repo import you/mirror --from https://github.com/you/repo.git \
 339    [--private] [--token-stdin]        # token on stdin, never in the URL
 340gitbay repo import-issues you/mirror --from you/repo --token-stdin
 341gitbay repo import-issues you/mirror --from you/repo \
 342    --api-base https://codeberg.org/api/v1    # Forgejo: the site's /api/v1
 343#+end_src
 344
 345=repo import= fetches over http and https only, from an address that
 346passes the same check as a webhook target; a =git://= URL is refused,
 347so use the repository's https URL.
 348
 349Sourcehut has no API of that shape; =repo import= takes its git data
 350and the todo.sr.ht tracker is not read.
 351
 352Moving between gitbay instances (no lock-in): run on the TARGET, with
 353your key registered on both sides. Profile, repos with settings,
 354issues, MRs, and comments replay with attribution; git data mirrors
 355client-side through your own key. Keys never transfer and emails
 356arrive unverified — trust is per-instance. Re-running resumes.
 357Push-blocking policies (require-signed, protected branches) are
 358deferred and printed for you to re-apply after the data lands.
 359=gitbay auth export= alone doubles as a user-level backup.
 360
 361#+begin_src sh
 362gitbay migrate --from old-instance.example [--from-port 22]
 363#+end_src
 364
 365Mirroring keeps a foreign remote in sync during a gradual migration
 366(repo admin; https remotes; the token is stored server-side for the
 367recurring sync and never echoed back):
 368
 369#+begin_src sh
 370gitbay repo mirror add you/project https://github.com/you/project.git \
 371    --direction push --token-stdin    # propagate after every local push
 372gitbay repo mirror add you/copy https://github.com/them/theirs.git \
 373    --direction pull                  # follow upstream; local pushes refused
 374gitbay repo mirror list               # sync status and last error, per mirror
 375gitbay repo mirror sync / remove <id>
 376gitbay repo mirror set-url you/project <id> https://github.com/neworg/project.git
 377                                      # same host; keeps the stored token
 378#+end_src
 379
 380Markdown and org files render on the web when opened, the way a README
 381does on the repository page, with relative links resolved against the
 382file's directory; =source= in the file's action bar (or =?view=source=)
 383shows the text instead. Other files show the text with highlighting.
 384
 385TeX math renders as MathML wherever markdown or org renders: READMEs,
 386files, wiki pages, issue, merge request and release bodies, comments,
 387and their previews. Markdown takes =$…$= inline and =$$…$$= for display,
 388either inline or with the =$$= lines on their own. A =$= followed by a
 389space, or a closing =$= preceded by a space or followed by a digit, is a
 390dollar sign, so =$5 and $10= stays prose; =\$= is always one. Org takes
 391=$…$=, =$$…$$=, =\(…\)=, =\[…\]= and =\begin{…}…\end{…}=. Code spans
 392and blocks are left alone. The supported TeX is a subset (letters,
 393numbers, operators, scripts, =\frac=, =\sqrt=, Greek and common symbols,
 394=\left=/=\right=, accents, =\text=, the =\math…= fonts, matrices,
 395=cases= and =aligned=; the full list heads =internal/texmath/texmath.go=).
 396Anything outside it, including macros, colours and links, shows as
 397source, as does an expression over 8 KiB or nested more than 64 deep,
 398and so does all math in a document after its first 1000 expressions or
 399256 KiB of TeX. A =$$= line opens display math only when a line ending
 400in =$$= follows before a blank line. MathML typed as raw HTML is
 401stripped like any other markup the sanitizer does not allow. The CLI
 402shows the source.
 403
 404* Deleting your account
 405
 406#+begin_src sh
 407gitbay auth delete --confirm <username>   # mails a link to your primary address
 408gitbay auth delete --cancel               # withdraw it before the link is opened
 409#+end_src
 410
 411The same is at the bottom of =/settings=. Nothing changes until the
 412mailed link is opened (it works for 24 hours, and needs a verified
 413address). Opening it disables the account at once and deletes it seven
 414days later: its repositories, snippets, keys, addresses and tokens go.
 415Issues, merge requests, comments and reviews it wrote on other people's
 416repositories stay, under the name =ghost=. Signing in during the seven
 417days — on the web, or any command over SSH with a full-scope key —
 418cancels; git-, read-, runner-scoped keys and API tokens are refused and
 419cannot cancel. The only admin of an organization is refused until
 420another admin exists or the organization is deleted. Export first
 421(=gitbay auth export=) to keep a copy. The username is free again after
 422the purge.
 423
 424* Organizations
 425
 426Orgs share the owner namespace with users and own repositories at
 427=org/repo=. By default members get write on all org repos; org admins
 428get repo admin, create repos under the org, and manage membership. An
 429org's existence and member list are public; its teams are visible to
 430members, and anyone else asking is refused rather than told the org
 431does not exist.
 432
 433#+begin_src sh
 434gitbay org create krz
 435gitbay org members add krz alice [--role admin]
 436gitbay org show krz
 437gitbay org rename krz newname     # clone URLs change
 438gitbay org delete krz --yes       # only when it owns no repositories
 439#+end_src
 440
 441Large orgs scope access with teams: set what plain membership implies,
 442then grant per-repo roles through named teams (org admins always keep
 443admin; the default =write= keeps the simple model):
 444
 445#+begin_src sh
 446gitbay org settings members-role krz none   # write | read | none
 447gitbay org team create krz core-devs
 448gitbay org team add krz core-devs alice bob # org members only
 449gitbay org team grant krz core-devs krz/gitbay write
 450gitbay org team show krz core-devs          # members + grants
 451gitbay org team revoke / remove / delete ...
 452#+end_src
 453
 454* Issues
 455
 456Anyone who can read a repository can file and comment. Closing/reopening
 457is for the author or anyone with write; labels and assignees need write.
 458
 459#+begin_src sh
 460gitbay issue create --title "it breaks" [--body "..." | --file -]
 461    [--label bug]... [--milestone v1.0] [--assignee alice]...  # these need write
 462gitbay issue list [--state open|closed|all]
 463gitbay issue show 4
 464gitbay issue comment 4 --message "same here"
 465gitbay issue react 4 +1 [--comment 12] [--remove]  # the same on mr
 466gitbay issue edit 4 --title "better title" [--body|--file -]  # author or write
 467gitbay issue close 4 / reopen 4
 468gitbay issue label 4 --add bug --remove wontfix
 469gitbay issue assign 4 --add alice
 470gitbay issue milestone 4 v1.0                 # or "none" to clear
 471#+end_src
 472
 473A reaction is one of =+1 -1 laugh hooray confused heart rocket eyes=,
 474given by name or as the emoji itself, on an issue or merge request or on
 475one of its comments (=show= prints comment ids). Anyone who may comment
 476may react; reacting twice or removing an absent reaction does nothing.
 477=show= carries the counts and which are yours. A reaction sends no
 478notification and appears in no activity feed.
 479
 480Inside a clone, the repository is inferred from the =origin= remote —
 481that is why no =owner/name= appears above. Anywhere else, pass it as the
 482first argument. Long text: =--body= inline, =--file -= from stdin, or
 483neither on a terminal and =$EDITOR= opens.
 484
 485A wiki is the =.gitbay/wiki/= directory on the default branch — no
 486separate repository, the same rendering pipeline as READMEs (markdown
 487and org). Editing it is editing a file: a push, =repo commit-file=, or
 488the web editor on a repository that permits server-authored commits (one
 489requiring signed commits is push-only, since the server signs nothing):
 490
 491#+begin_src sh
 492mkdir -p .gitbay/wiki
 493# add Home.md (or .org), more pages, images; relative links between
 494# pages just work on the web at /you/project/wiki
 495git add .gitbay/wiki && git commit -m "wiki" && git push
 496#+end_src
 497
 498Pages may sit in subfolders. A nested page is named by its path —
 499=.gitbay/wiki/Guide/Install.md= is =/you/project/wiki/Guide/Install= and
 500=wiki show you/project Guide/Install= — and the sidebar groups it under
 501its folder. A relative link or image on a nested page resolves from the
 502page's own folder first, then from the top of the wiki, so a link to
 503=Home= still reaches the top-level page. SVG images render.
 504
 505Releases anchor notes and binary assets to a pushed tag (write access;
 506assets stream over SSH, capped by the instance's =max_asset_bytes=).
 507While a release exists its tag can be neither deleted nor moved, whether
 508or not the tag is protected: delete the release first.
 509
 510#+begin_src sh
 511gitbay release create v1.0 --title "First light" [--notes|--file -|$EDITOR]
 512gitbay release asset add v1.0 tool-linux-amd64 < dist/tool-linux-amd64
 513gitbay release asset get v1.0 tool-linux-amd64 > tool   # or the web download link
 514gitbay release list / show v1.0 / delete v1.0 --yes
 515gitbay release notes v1.0 [--since <tag>]   # one line per merge request since the previous release
 516#+end_src
 517
 518=release notes= drafts the notes: every merge request landed between the
 519previous release's tag (or =--since=) and the ref, oldest first, as
 520=- <title> (!<n>) by @<author>=. The ref may be a branch, for drafting
 521before the tag exists. Pipe it into =release create --file -=, or press
 522Summarize changes on the web form, which appends the same lines to the
 523notes box. A merge request is attributed by the commit it landed as;
 524one merged by squash or rebase before the instance recorded it is not
 525listed.
 526
 527The web shows them under the repository's =releases= tab with rendered
 528notes, sha256 sums, and download links; writers add and remove assets
 529there (a file upload, up to =max_asset_bytes=; removal asks for the file
 530name). Feed readers subscribe at
 531=/you/project/releases.atom=; commits are at =/you/project/log.atom=
 532(the default branch) or =/you/project/log.atom/<ref>=, and an owner's
 533activity on their public repositories at =/you/activity.atom=. The
 534pages carry the discovery link.
 535
 536Commit messages act on issues when the commits land on the default
 537branch (direct push, MR merge, =repo commit-file= or the web editor):
 538=closes/fixes/resolves #4= closes the
 539issue with a linking comment, and a bare =#4= leaves a reference
 540comment. Each issue/commit pair acts once, ever. =Closes owner/name#N= closes an issue in another repository when
 541you hold write there with a key whose scope reaches it; otherwise it
 542stays a plain link. A deploy key closes nothing outside the repository
 543it is bound to, but naming that repository by full path works as the
 544bare form does. The comment left
 545on the closed issue links the closing commit by its repository path, so
 546closing a public repository's issue from a private one names the private
 547repository there. A bare =owner/name#N= links and does nothing.
 548
 549Milestones group issues and MRs toward a release (write access to
 550manage, attach with =issue milestone= / =mr milestone=; progress shows
 551on the web at =/owner/name/milestones=, where writers create, close and
 552reopen them):
 553
 554#+begin_src sh
 555gitbay milestone create v1.0 --description "first release" --due 2027-01-01
 556gitbay milestone list [--state open|closed|all]
 557gitbay milestone close v1.0 / reopen v1.0
 558#+end_src
 559
 560An org holds labels and milestones every repository under it sees
 561beside its own. =issue label --add=, =mr label --add=, =issue
 562milestone= and =mr milestone= resolve the org's row first; a repository
 563cannot create a label or milestone with a name its org holds. Creating
 564an org label or milestone whose name repositories under the org already
 565use folds them in: their issues and merge requests move to the org's
 566row. Org admins manage them, on the CLI or at =/<org>/-/labels= and
 567=/<org>/-/milestones=; counts span the repositories you can read.
 568
 569#+begin_src sh
 570gitbay org label set acme bug --color cf222e
 571gitbay org label list acme / remove acme bug
 572gitbay org milestone create acme v2 --due 2027-03-01
 573gitbay org milestone list acme [--state open|closed|all]
 574gitbay org milestone close acme v2 / reopen acme v2
 575#+end_src
 576
 577On the web: =/acme/-/labels= and =/acme/-/milestones=, read-only.
 578
 579Issue templates: commit =.gitbay/issue-template.md= (and optional
 580=issue-template-<name>.md= variants) to the default branch. =gitbay
 581issue create= prefills =$EDITOR= with the default template, the web
 582form prefills its textarea, and =gitbay issue templates= lists them.
 583
 584Lists narrow the same way on every surface: =issue list --label bug
 585--assignee bob --author alice --milestone v1= (or =--milestone none=),
 586=mr list --label bug --author bob --milestone v1=; the web's issue and
 587merge request lists take the same names as query parameters, and each
 588active filter shows with a link that drops it.
 589
 590A query spans repositories, and a saved one keeps it under a name:
 591
 592#+begin_src sh
 593gitbay query save mine is:open assignee:@me
 594gitbay query save triage 'repo:krz/*' is:issue is:open no:label
 595gitbay query save v2 owner:krz label:bug 'label:needs review' milestone:v2
 596gitbay query list / show mine / remove mine
 597gitbay query run mine [--limit 20] [--cursor <c>]   # issues and MRs
 598gitbay query run --q 'is:open assignee:@me'        # unsaved, issues and MRs
 599gitbay issue list --query mine                     # only the issues
 600gitbay mr list --q 'owner:krz is:open author:@me'  # a query written out
 601gitbay query pin mine                              # on the dashboard; unpin
 602#+end_src
 603
 604The terms: =repo:owner/name=, =repo:owner/glob*= (=*= in the name
 605only), =repo:*=, =owner:name=; =is:open=, =is:closed=, =is:merged=,
 606=is:issue=, =is:mr=; =label:x= (repeat it: every label must be there),
 607=no:label=; =milestone:x=, =no:milestone=; =assignee:user=,
 608=author:user=, either as =@me= for whoever runs the query. Anything
 609without a colon is text matched against title and body, as =search=
 610does. Every term narrows, except that several =repo:= and =owner:=
 611terms widen the scope to any of them; with none the query covers every
 612repository you can read, and only those — someone else's private
 613repository is neither a row nor part of a count. Merge requests have no
 614assignees, so =assignee:= means issues. A term that does not parse
 615exits 2 and names itself. =@me= is resolved when the query runs, and
 616the saved text is the query in a canonical order.
 617
 618Rows come newest first, each naming its repository, paged as ={items,
 619next}= with fifty to a page unless =--limit= says otherwise.
 620An account keeps at most 50 saved queries, 10 of them pinned; past
 621either, =query save= or =query pin= exits 2 until one is removed or
 622unpinned. =dashboard --json= carries each pinned query's count and first five
 623rows under =queries=; the web dashboard shows them, and
 624=/you/-/queries= lists your saved queries with a page per query.
 625
 626Labels take a colour: =gitbay label set bug --color cf222e=; =label
 627list= shows each with its colour and how many issues and merge requests
 628carry it, and =label remove= takes one off all of them. =issue label
 629--add= and =mr label --add= still create a colourless label on the fly.
 630
 631* Merge requests
 632
 633#+begin_src sh
 634gitbay mr create --source feature --target main --title "add thing"
 635gitbay mr create other/upstream --source you/fork:feature --target main --title "..."
 636gitbay mr list / show 4 / diff 4
 637gitbay mr checkout 4              # local branch mr/4 from the MR head
 638gitbay mr review 4 --approve      # or --request-changes / --comment
 639gitbay mr label 4 --add bug --remove wontfix
 640gitbay mr merge 4 [--strategy ff|merge|squash|rebase]
 641gitbay mr merge 4 --when-ready      # merge once the gates pass; --cancel dequeues
 642gitbay mr close 4
 643#+end_src
 644
 645A merge request closed without merging can name the one that carries
 646its change forward: =mr close 4 --by 7= records it and both pages show
 647it, and =mr edit 4 --superseded-by 7|none= sets or clears it
 648afterwards, refused on anything but a closed merge request.
 649
 650The web list shows each request's combined check state and comment
 651count alongside its title, so open work needing attention stands out
 652without opening it.
 653
 654Semantics worth knowing:
 655
 656- the MR head lives in the *target* repository as
 657  =refs/merge-requests/N/head= (fetchable by any reader), so an MR
 658  survives deletion of its source branch or fork. It is never removed
 659  on merge or close; after a history rewrite an instance admin can
 660  drop it with =admin mr prune=.
 661- force-pushing the source updates the MR and marks existing reviews
 662  stale — unless the diff is the one they reviewed. A rebase onto a
 663  target that moved on changes every sha and nothing about the change,
 664  so fresh reviews follow it to the new head; a push that changes the
 665  diff stales them.
 666- default strategy: fast-forward when possible, else a merge commit.
 667  Squash makes one commit authored by the MR author, committed by the
 668  merger. Rebase replays a linear range preserving authors; it refuses
 669  ranges containing merge commits, and when fast-forward is possible it
 670  *is* one (original commits and signatures land untouched).
 671- on =require_signed_commits= branches only fast-forwards of fully
 672  verified commits merge; everything server-created is refused with
 673  instructions to rebase locally. =gitbay mr rebase <n>= is those
 674  instructions: in a clone of the target it replays the source branch
 675  onto the target and force-pushes it, then =mr merge <n>= fast-forwards.
 676  The replay is local, so the commits carry your signature and not the
 677  server's — it holds no key. A branch living in a fork is refused, with
 678  the repository to run it in; rebase it there.
 679
 680Repo admins can gate merges (=repo settings ...=): =require-approvals
 681<n>= (fresh, non-author approvals; each reviewer's latest review is
 682their stance, and a fresh request-changes blocks), =require-resolved=
 683(no open review threads), =require-checks= (all statuses green), and
 684=require-codeowners= (an approval from an owner of every owned changed
 685file). Owners come from a =CODEOWNERS= file on the target branch, root
 686or =.gitbay/=, gitignore-style patterns, last match wins. The toggle is
 687the opt-in, so a repository can carry the file as documentation of who
 688to ask without it gating merges; with it on and no file on the target
 689branch, the merge is refused and says so. It does not wait on
 690=require-approvals=.
 691
 692=mr show= carries a =gates= block with where the merge request stands
 693against all of them — approvals counted and required, owners still
 694outstanding per file, open threads, checks, and whether a fast-forward
 695is possible — and the merge request page shows the same block. =mr
 696merge= names every unmet gate at once rather than the first. =mr
 697review= says when a verdict is advisory, which it is from anyone
 698without write access: the gates do not count it.
 699
 700=mr merge <n> --when-ready= queues the merge and merges once the gates
 701pass, or at once if they already do. It is tried again when a status
 702is reported on the head, a review is submitted, a thread is resolved,
 703the request is marked ready, and the source branch is pushed; a push
 704by someone who can write to the target keeps it queued, and the new
 705head has to pass on its own. The merge is made as the user who queued
 706it, with their rights checked at that moment. Anything the queuer can
 707fix (an unmet gate, a conflict, a branch behind a
 708=require_signed_commits= target that needs a rebase) leaves it queued
 709with the reason shown on =mr show= and the page.
 710
 711The queue is bound to the credential it was made with. It is dequeued,
 712with the reason on the request's timeline, when:
 713
 714- the queuer loses write access or their account is disabled;
 715- the SSH key or API token it was queued with is removed, revoked,
 716  expires, or no longer has full scope (a merge queued from the web
 717  rests on the account alone);
 718- someone who cannot write to the target pushes to the source branch
 719  or retargets the request;
 720- the source branch is deleted, or the request is closed.
 721
 722An expiring key or token cannot queue a merge; use one without an
 723expiry, or the web. =mr merge <n> --cancel= dequeues without closing.
 724=merge= and =squash= are refused at queue time on a
 725=require_signed_commits= repository.
 726
 727Those gates apply to =mr merge=. A direct push to a protected branch
 728passes none of them until =require-mr on=: then an existing protected
 729branch refuses every push, including =repo commit-file= and the web
 730editor, and the server's merge is its only writer. Creating the branch
 731is still a push, since there is nothing to open a merge request against
 732yet.
 733
 734A merge request whose head reaches its target some other way — a direct
 735push, or inside another merge request that is merged — is recorded as
 736merged by whoever moved the branch, including one whose source branch
 737is gone. One whose head was on the target before the update is left
 738alone; =mr merge= on it records it as merged.
 739
 740A merge request whose target is another open merge request's source
 741branch is stacked on it: =mr create= says so, =mr show= carries
 742=stacked_on= and =stacked=, and merging the lower one retargets the
 743upper onto =main= with its reviews kept. See [[Stacked-MRs][Stacked
 744merge requests]].
 745
 746Review threads anchor to diff lines:
 747
 748#+begin_src sh
 749gitbay mr diff-comment 4 --path main.go --line 12 --message "use log here"
 750gitbay mr diff-comment 4 --reply 7 --message "done"     # join thread 7
 751gitbay mr threads 4                                     # threads with staleness
 752gitbay mr resolve 4 7 / unresolve 4 7
 753#+end_src
 754
 755Threads render inline on the MR page. A force-push marks them stale
 756(shown under "threads on earlier revisions") rather than guessing new
 757anchors; =mr show= reports the unresolved count. Resolving is for the
 758thread author, the MR author, or anyone with write.
 759
 760A thread can span lines: =--start-line 12 --line 13= anchors it to
 761lines 12 and 13 of the new file. A fenced =suggestion= block in the
 762comment proposes replacement lines for that range; an empty block
 763proposes deleting it.
 764
 765#+begin_src sh
 766gitbay mr diff-comment 4 --path main.go --start-line 12 --line 13 --file - < suggestion.md
 767gitbay mr apply-suggestion 4 9       # commit thread 9's suggestion
 768#+end_src
 769
 770where =suggestion.md= is
 771
 772#+begin_example
 773one call does both
 774```suggestion
 775	log.Printf("starting %s", name)
 776```
 777#+end_example
 778
 779The page and =mr threads= show a suggestion as the lines it replaces
 780and the lines it proposes; =mr threads --json= carries it as
 781=suggestion= with the path, the line range, the commit and blob it was
 782made against, the original and replacement text, =outdated= with a
 783reason, and =apply= (=server= or =local=). A suggestion is outdated
 784once the lines it replaces differ at the head from what it was made
 785against, or the file is renamed or deleted; it cannot be applied then.
 786
 787Applying commits the replacement to the source branch as the applying
 788user, with a message naming the merge request and thread, and resolves
 789the thread if the applier could resolve it by hand (the thread author,
 790the MR author, or a writer of the target); otherwise the thread stays
 791open and the output says so. It is a push: only the source branch's
 792writers can apply (for a merge request from a fork, the fork's
 793writers), the branch's protection, =require-mr= and the owner's storage
 794quota apply, and a queued merge treats it as a push by the applier. The web's Apply suggestion button and =mr
 795apply-suggestion= commit it on the server. The server cannot sign, so
 796where the source or target requires signed commits (=apply= is
 797=local=) the CLI fetches the source branch into the clone it runs in,
 798builds the commit without touching the working tree, signs it with
 799=git commit-tree -S= under your git signing configuration, pushes it,
 800and resolves the thread; the page shows that command.
 801
 802* CI builds
 803
 804A =.gitbay/ci.yml= in the repo runs jobs on every branch push:
 805
 806#+begin_src yaml
 807jobs:
 808  test:
 809    steps:
 810      - go test ./...
 811#+end_src
 812
 813A config holds at most ten jobs of fifty steps each, each step under
 8144096 bytes, in a file under 64 KiB; a longer step runs a script from the
 815repository (=- sh ci/publish.sh=). A config past a cap, or otherwise
 816unparseable, records a failed =ci/config= status on the commit and
 817queues nothing, so look there when a push builds nothing.
 818
 819Each job becomes a build (=build list=, =build log=, the builds tab on
 820the web) and a =ci/<job>= commit status, which =repo settings
 821require-checks= can gate merges on. =repo settings
 822require-contexts= names statuses the gate waits for until they report,
 823and turns the gate on. =build list= takes =--ref=,
 824=--status= and =--job= to narrow the listing, combinable; the builds
 825tab reads the same flags from its =?ref=, =?status= and =?job= query
 826parameters and groups the result into one row per commit. =build show=
 827names a failed build's step and how long it ran, and =build log= takes
 828=--step <n>|failed= and =--tail <lines>=. Steps run
 829with =sh -c= on the instance's runner, stopping at the first failure;
 830a broken config surfaces as a failed =ci/config= status. Environment:
 831=GITBAY_REPO=,
 832=GITBAY_SHA=, =GITBAY_REF=, =GITBAY_JOB=, =CI=true=, and =GITBAY_SSH=,
 833the instance's ssh destination as the build reaches it: on the forge's
 834own runner, =git@169.254.1.2=, pasta's address for the host, with
 835=:port= when the instance's ssh is not on 22; from any other runner,
 836the destination that runner polls (its =-remote=, such as
 837=git@gitbay.org=). Use it as =ssh://$GITBAY_SSH/owner/name.git= or
 838=ssh ssh://$GITBAY_SSH …=, which work in either form. A job that
 839talks back to the instance — a release asset, a comment, a push to a
 840pages branch — uses =$GITBAY_SSH= with a key it holds as a secret;
 841the build's container has no key of its own. On the forge's own runner a
 842build from a fork's merge request cannot reach the instance at all, and
 843reaches the internet only over HTTPS, HTTP and DNS (CI page). Two things about that
 844container: a secret with newlines (a private key) arrives intact, and
 845=ssh= expands =~= from the passwd entry, =/root=, not from =$HOME=,
 846which is the build home — so keep an ssh config in the workspace and
 847pass it with =ssh -F= (and =GIT_SSH_COMMAND="ssh -F ..."= for git),
 848which also works on a runner with no container, where writing to
 849=~/.ssh= would edit that machine's own configuration.
 850
 851Secrets: =repo secret set <owner/name> <NAME>= reads the value from
 852stdin (never argv) and injects it into the repo's builds as =$NAME=;
 853=repo secret list= shows names only, and the value is never echoed
 854back. Anyone with write access can read a secret from inside a build,
 855so scope them accordingly.
 856
 857Schedules: a job with =schedule: "17 11,23 * * *"= (five-field cron,
 858server-local time; lists, ranges, and steps supported) runs on its cron
 859against the default branch instead of on push. A default-branch push
 860registers or updates the schedule. A job with =tags: "v*"= runs when a
 861matching tag is pushed — and only then; =schedule= and =tags= are
 862mutually exclusive. =build trigger <owner/name> <job>= queues any job
 863immediately, and =build cancel <owner/name> <n>= withdraws one, queued
 864or running: a running build stops at the runner within seconds and the
 865log says who cancelled it. Both need write access.
 866
 867What each push shape queues, with dedupe, path filters, schedules and
 868the reaper together, is one table on [[CI][CI]].
 869
 870** Your own runner
 871
 872Builds run on runners attached to the repository. An instance need not
 873offer any: install =gitbay-runner= on a machine of yours and attach it.
 874
 875#+begin_src sh
 876brew install krz/tap/gitbay-runner        # or a binary from the release
 877gitbay-runner init -remote git@gitbay.org
 878#+end_src
 879
 880=init= generates a key under =~/.config/gitbay-runner/=, writes
 881=config.toml= beside it, and prints the public key with the command to
 882attach it:
 883
 884#+begin_src sh
 885gitbay repo runner add owner/name < ~/.config/gitbay-runner/id_ed25519.pub
 886#+end_src
 887
 888or paste the key under Runners on the repository's settings page. Then
 889=brew services start krz/tap/gitbay-runner=, or run =gitbay-runner= with
 890no arguments; it reads the config file, and any flag overrides it.
 891
 892What it builds: every build for the repositories it is attached to,
 893with the repository's secrets, and nothing else. Merge requests from
 894forks are untrusted and wait unless the runner runs with =-untrusted=,
 895which is only sensible with =-isolation podman -image <ref>= (see
 896[[Admin][Admin]]). Attach one runner to several repositories by repeating
 897=repo runner add=; run several runners on one account by running =init=
 898on each machine. =repo runner list= shows each attached key, when it
 899last polled and the build it holds; =repo runner remove <fingerprint>=
 900detaches one (the key stays on your account; =keys remove= drops it).
 901A runner key reaches only the runner protocol and read-only git, so a
 902build step that reads it off disk cannot administer your account.
 903
 904=repo runner add owner/name --jobs a,b < key.pub= narrows an
 905attachment to the named jobs, so two runners can share a repository by
 906job: one that reaches a geo-blocked data source for the repository's
 907own job (=--jobs daily-pull=), another with the code scanning image
 908(=--jobs gitbay-security=). A re-add without =--jobs= keeps the list;
 909=--jobs all= restores every job. =repo runner list= shows it.
 910
 911* Large files (LFS)
 912
 913Standard Git LFS works over both transports with no setup beyond the
 914usual =git lfs track=. SSH remotes authenticate through
 915=git-lfs-authenticate= (deploy keys included: ro keys can download, rw
 916keys upload); anonymous HTTPS clones of public repositories can fetch
 917LFS objects with no credentials. Objects are verified against their
 918sha256 on upload and capped at 512MB by default.
 919
 920* Pages
 921
 922On instances with =[pages] domain= set, a =pages= branch in any public
 923repo is served as a static site: the repo named =pages= at
 924=https://<you>.<domain>/=, every other repo at
 925=https://<you>.<domain>/<repo>/=. Push HTML to publish; a CI job can
 926build and push the branch for automatic deploys. Sites run on a
 927separate origin — your scripts work, and the forge's cookies are out of
 928reach.
 929
 930A repo can also serve its pages branch on a domain you own.
 931=repo domain add <owner/name> <domain>= claims it and prints a DNS TXT
 932challenge (=_gitbay-challenge.<domain>=); create the record, run
 933=repo domain verify=, then point the domain's A/AAAA records at the
 934instance (DNS-only if the domain sits behind a proxying provider — the
 935instance issues its own certificates). Claims are exclusive per
 936instance; unverified claims serve nothing and expire after 7 days.
 937=repo domain list= reports pending/verified/expired.
 938
 939* Snippets
 940
 941A snippet is one or more named text files you own outside any
 942repository, for a log or a fragment shared by URL. Create one from a
 943file on stdin; the reply is the id and the URL:
 944
 945#+begin_src sh
 946gitbay snippet create build.log --description "failing build" < build.log
 947gitbay snippet file set <id> notes.txt < notes.txt   # add or replace a file
 948gitbay snippet file get <id> build.log > build.log
 949gitbay snippet edit <id> --visibility public
 950gitbay snippet list                                  # yours
 951gitbay snippet list <owner>                          # their public ones
 952gitbay snippet delete <id>
 953#+end_src
 954
 955Visibility is =public= (listed on your page), =unlisted= (anyone with
 956the URL, listed nowhere; the default) or =private= (you alone; not
 957found to everyone else). Files are text, valid UTF-8, each under the
 958instance's =max_snippet_bytes=, at most 64 per snippet. A snippet keeps
 959at least one file. There is no history: setting a file replaces it.
 960
 961On the web, =/<you>/-/snippets= lists yours, each snippet page renders
 962its files with a raw link per file, and the same page creates, edits
 963and deletes through the commands above.
 964
 965* Browser sessions
 966
 967=gitbay web login= mints a one-time URL; the session it opens ends
 968after twelve hours without a request, and after seven days in any case.
 969=gitbay web sessions list= shows each of yours by a short id with its
 970creation, expiry and last use, and =gitbay web sessions revoke <id>=
 971or =--all= ends them from the terminal, which is where a lost laptop is
 972handled.
 973
 974Actions that create a credential or grant access (adding a key, token
 975or email, org and repository roles, transfers, a repository's
 976visibility) ask you to sign in again
 977when your web sign-in is older than 15 minutes. The form shows a "Sign
 978in again" link and the login returns to the page. Idle renewal does not
 979extend this window.
 980
 981=web theme set light= or =dark= fixes the web UI's colour scheme for
 982your account; =system=, the default, follows the browser's own
 983preference. =web theme show= prints it. The account page has the same
 984control under Appearance.
 985
 986=web diff set split= draws diffs side by side on the merge request,
 987commit and compare pages; =unified=, the default, keeps one column.
 988=web diff show= prints it, and the account page has the same control
 989under Appearance. =?layout=split= or =?layout=unified= on a diff page
 990overrides the setting for that request. In a narrow window the split
 991layout stacks the old line over the new one, as a unified diff does.
 992Each column's line numbers open a comment on their own side.
 993
 994* Notifications
 995
 996When the instance has SMTP configured, activity mails you as well as
 997filing the inbox row: someone opens an issue or MR on your repository,
 998comments where you are a participant (author, commenter, reviewer, or
 999mentioned), reviews, closes, merges, or assigns you.
1000=notifications settings mail off= keeps the inbox and stops that mail
1001(login links are not activity and still arrive); the account page has
1002the same switch.
1003=notifications settings watch on= makes you a recipient of every issue
1004and merge request on the repositories you can write to, as if you had
1005run =repo watch= on each: it is consulted when a notice is delivered,
1006so a grant or a revoke needs no watch row, and an explicit watch or
1007mute on a repository still wins. Off by default; the account page has
1008this switch too. Writing =@name= in an issue, merge request or
1009comment files "mentioned you" in that account's inbox and makes them a
1010participant of the thread, provided they can read the repository and
1011have not muted it; watchers are not told about a mention addressed to
1012someone else.
1013You are never mailed about your own actions, and only verified primary
1014addresses receive anything. Delivery retries on relay failure.
1015
1016=notifications settings reply on= lets you answer that mail: issue and
1017merge request mail then carries a =Reply-To= address, and replying to
1018it posts your reply as a comment on the thread, as you. Off by
1019default; the account page has the switch when the instance reads
1020replies, and turning it on is refused where it does not
1021(=[mail.inbound]= off). =notifications settings show --json= says which
1022as =reply_available=. A reply is posted only when it comes from one
1023of your verified addresses, you can still comment on the thread, and
1024the mail it answers is less than thirty days old. Quoted text (lines
1025starting with =>=, the "On … wrote:" line and what follows it, the
1026header block Outlook quotes) and everything after a =-- = signature
1027line are removed, and the rest is stored as markdown. HTML-only mail is
1028not accepted; send plain text or the usual plain-and-HTML pair. A
1029refused reply gets no answer: nothing is mailed back. Each reply
1030address names you, so do not forward notification mail you would not
1031want answered from your own address.
1032
1033Push is the same activity again, delivered to a phone: the iOS app
1034registers a device, and =notifications settings push off= silences it
1035the way =mail off= silences mail, without deregistering anything.
1036=notifications device list= shows what is registered (token shown
1037truncated); =notifications device remove <id>= drops one by hand, from
1038the CLI or the account page. A device is also dropped on its own the
1039moment Apple reports the token dead, so an app deleted from a phone
1040stops costing anything without you having to notice. Push only works
1041when the instance operator has configured it: on an instance with
1042=[push] enabled = false=, =notifications device add= refuses rather
1043than registering a device nothing can deliver to.
1044
1045Push notifications carry the notice in full: a private repository's
1046name and the issue or merge request number reach Apple and can appear
1047on a lock screen, the same as any other text a phone shows in a
1048notification. This is deliberate, not an oversight — weigh it against
1049what you keep in a private repository before registering a device.
1050
1051* Web vocabulary
1052
1053Sign in / Log out, Search, sentence-case headings and buttons, product
1054name lowercase.
1055
1056* Output rules
1057
1058=--json= is the contract; the plain output is for a person at a
1059terminal, and follows these rules so every noun reads the same way.
1060
1061- A list command prints one row per item, tab-separated, no header.
1062  Columns run identifier, state, then description; a trailing column
1063  may carry a word (=due 2027-01-01=, =via team=). Piped, a timestamp in
1064  a row is RFC3339 to the second, UTC. Under =--json= nothing is
1065  touched.
1066- An empty list prints nothing on stdout and =nothing to list= on
1067  stderr.
1068- A mutation prints one line: verb, object, identifier
1069  (=created krz/gitbay#7=). A second line appears only for something
1070  to copy: a URL, a token shown once.
1071- A bad invocation prints =usage:= and the command's registered usage,
1072  the same text =help <noun>= shows. Exit 2.
1073- A refusal says who may and what to do instead: =only admins of acme
1074  can manage teams; ask one to add you=. Exit 4. A thing that does not
1075  exist, or that you may not know exists, is exit 3.
1076- stdout is the result; stderr is everything else: progress, a note
1077  that output was truncated, errors.
1078- Verbs: =create= and =delete= for things with their own identity
1079  (repository, issue, release, team), =add= and =remove= for attaching
1080  something to them (a key, a member, a label on an issue), =set= for
1081  a value, =revoke= for a credential, =show= and =list= for reads.
1082
1083** At a terminal
1084
1085The =gitbay= CLI sends a leading =--term=<cols>[,<option>]...= argument on
1086the SSH command line when stdout is a terminal (OpenSSH's multiplexed
1087sessions, which the CLI uses, do not forward a session's =SetEnv=).
1088The argument goes first: the server reads =--term=<v>= only as the
1089first argument, and ignores it over HTTP. =color= is the one option
1090the server acts on; it ignores options it does not know. The server
1091then prints:
1092
1093- lists padded and fitted to the width (the title or description
1094  column is cut with =…= first; a title or description column blank on
1095  most rows is held to a third of the width), with no trailing
1096  whitespace. A list has a dim header row only when a column is a
1097  number or a size, which would not say what it counts without one. The
1098  next page is a =Next page= line on stderr with the command that
1099  fetches it (piped output keeps a =next\t<cursor>= row instead);
1100- colour by meaning: green for open, success, approved, verified; magenta
1101  for merged; red for failures, =private=, and bad or untrusted
1102  signatures; dim for closed, pending, archived, unsigned; yellow only
1103  for what waits on you (an unverified address); references (=#12=,
1104  =krz/gitbay=, SHAs) dim. A marker piped output keeps as its own
1105  trailing cell (=[archived]=, =primary=) joins the state at a terminal:
1106  =public, archived=;
1107- every list and show drawn as a screen: a header block of =Label:=
1108  lines (labels dim), the description or notes, sections titled =Title
1109  (n)= in bold blue, and a legend under a rule of the commands that
1110  apply now, grouped and chosen from the item's state and your access.
1111  Rows have no header (unless a column is a number or a size) and no
1112  indent: a dim reference, a state glyph, the text, then dim facts
1113  joined by =·=. The glyphs are =✓= passed, =✗= failed or blocked, =◐=
1114  still going, =●= waiting on you (your review requested, an issue
1115  assigned to you, an unread notification, a pending account, an
1116  overdue milestone, the session's own key), =○= closed or draft. A
1117  section cut short ends with =+n more= and the command for the rest.
1118  Below 80 columns the legend's groups stack; a suggested command is
1119  never cut, so it may run past the width. =dashboard= opens with what
1120  waits on you; for admins a =Problems= line counts background
1121  failures, and =admin stats= has the detail. =repo commit= prints its
1122  screen, then the diff. Secrets never appear on a screen, and a
1123  webhook URL shows its scheme and host only. =wiki show= piped prints
1124  the page source verbatim;
1125- errors on stderr after a red =error:=, a mistyped flag with the flag
1126  it is closest to (=did you mean --state?=), and a usage line wrapped
1127  to the width between its bracketed groups, one alternative per line;
1128- help with flag descriptions, defaults, and examples; =gitbay --help=
1129  groups commands under WORK, REPOSITORIES, YOU and INSTANCE;
1130  =help --json= adds =flags= and =examples=.
1131
1132=NO_COLOR=, =TERM=dumb= and =--no-color= drop the colour. =show=,
1133=diff= and =log= at a terminal go through =$GITBAY_PAGER=, else
1134=$PAGER=, else =less= (with =LESS=FRX= when =LESS= is unset); an empty
1135=GITBAY_PAGER= turns paging off. Paging never applies to =--follow=,
1136=--json=, or piped output.
1137
1138Inside a clone of a repository on the instance, the CLI adds
1139=here=<owner/name>= to =--term=, so a command the output suggests leaves
1140that repository out, as the CLI would infer it. An instance that does
1141not know the option ignores it.
1142
1143=GITBAY_TERM=off= stops the CLI sending =--term= at all, for an
1144instance older than v1.36.0, which refuses the argument as an unknown
1145command.
1146
1147Two more options say what the terminal can show. =truecolor= (sent when
1148=COLORTERM= is =truecolor= or =24bit=) puts a dot in each label's own
1149colour beside its hex in =label list=. =links= (sent in iTerm2, WezTerm,
1150Ghostty, VS Code, kitty and VTE terminals, or when =GITBAY_LINKS=1=;
1151=GITBAY_LINKS=0= stops it) makes references in lists open their page,
1152as OSC 8 hyperlinks. A terminal outside that list would print the
1153escape's text, so it is not sent there by default. =GITBAY_TERM=basic=
1154sends only the width and colour, for an instance older than the release
1155that added these options, which turns any option it does not know into
1156plain output.
1157
1158Stock ssh without the CLI's multiplexing gets the plain output unless
1159it passes the same leading argument or sets the environment variable
1160sshd is told to accept. OpenSSH parses options after the host, so the
1161argument goes after =--=:
1162
1163#+begin_src sh
1164ssh git@gitbay.org -- --term=120,color issue list krz/gitbay
1165ssh -o SetEnv=GITBAY_TERM=120,color git@gitbay.org issue list krz/gitbay
1166#+end_src
1167
1168* Scripting
1169
1170Every read command takes =--json= and emits one envelope:
1171={"protocol_version": 1, "data": ...}=. stdout is data, stderr is
1172messages. Exit codes are stable: 0 ok, 1 failure, 2 usage, 3 not found,
11734 denied, 5 server/protocol error. Usage means the arguments were wrong;
1174a refusal — a name already taken, a state that does not allow the change
1175— is a failure. Nothing ever prompts; destructive commands take =--yes=.
1176
1177For HTTP automation see [[API]].
1178
1179* CLI setup
1180
1181#+begin_src sh
1182gitbay remote add myforge forge.example.org [--port n] [--user u] --default
1183gitbay remote list
1184gitbay init [name] [--private]   # git init + repo create + origin, in one step
1185#+end_src
1186
1187Configuration lives at =~/.config/gitbay/config.toml=. The CLI shells
1188out to your real =ssh=, so =~/.ssh/config=, the agent, and hardware keys
1189all apply. It shares one connection per instance through a control
1190socket under =~/.ssh=: the first command in five minutes pays the
1191handshake and the rest ride it. =no_multiplex = true= on an instance in
1192the config turns that off. Man pages: =gitbay man --dir <dir>=; completions:
1193=gitbay completion bash|zsh|fish=.
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form