Brokered Git Push
An agent can ask for a git push without ever holding push credentials. It signs a request; murmurd checks it against what you enrolled and parks it; nothing reaches the remote until you approve that exact ref update.
mur git-push enroll --agent coder --repo app --remote origin \
--endpoint file:///srv/git/app.git --path ~/code/app
mur git-push list
mur git-push doctor
mur git-push revoke --agent coder --repo app --remote origin
Unix only. The broker is off by default.
Turn it on
Two switches in ~/.mur/config.yaml, both deny-by-default:
git_push:
enabled: true # off: the daemon does not run the broker and no agent gets the tools
agents: [coder] # the only agents that see git_push_request / git_push_status / git_push_cancel
An agent not listed never sees the push tools, so it does not learn the broker exists and cannot add requests to your approval queue. The list lives in global config rather than the agent profile so a prompt-injected agent cannot widen it.
mur git-push doctor warns when the broker is on with an empty agents list, or when the list names an agent that does not exist.
Enroll a remote
An enrollment says: this agent may ask to push this repo to this remote, on these branches.
mur git-push enroll --agent coder --repo app --remote origin \
--endpoint file:///srv/git/app.git \
--path ~/code/app \
--base-ref refs/heads/main
| Flag | Meaning |
|---|---|
--agent | The agent allowed to ask. Matched case-insensitively against the agents on disk |
--repo | A name for the repo. The agent refers to it by this name, never by a path |
--remote | A name for the remote. The agent refers to it by this name, never by a URL |
--endpoint | file:///absolute/path/to/remote.git, or https://<dns-name>[:<port>]/<path> |
--path | The agent's repo directory. Required the first time --repo names a new repo |
--object-format | sha1 (default) or sha256. Only with --path |
--ref-prefix | Branches the agent may push. Default refs/heads/agent/<agent>/ |
--base-ref | A full refs/heads/<name> the agent may create a branch from. Repeatable; default none |
--username | https only. The login name for the remote. Needs --secret |
--secret | https only. Absolute path of the token file: a 0600 regular file you own, under ~/.mur/secrets/. Nothing in it is expanded (no ~, $, . or ..). Needs --username |
--read-username | https only. A second, read-only login used for the fetch before approval, so the push token stays unopened until you approve. Needs --read-secret, --username and --secret |
--read-secret | https only. Absolute path of the read token file, under the same rules as --secret. Must be a different token from --secret. Needs --read-username |
--allow-unauthenticated | https only. Enroll with no credential, for a remote that accepts anonymous pushes. Cannot be combined with --username / --secret / --read-username / --read-secret |
Enroll runs the same checks as mur git-push doctor first. If any check refuses, it prints refused: … for each one, then nothing was written, and exits 1. Among the refusals:
- a
--ref-prefixthat reaches outside the agent's own namespace; - a
file://endpoint that is a symlink or alias, or does not exist; - an endpoint the agent can write to — a hook there would run with the broker's privileges;
- an agent that may run without its sandbox, and so could rewrite the enrollment;
- an
https://endpoint with no credential and no--allow-unauthenticated; - a
--read-secretthat is the same token as--secret: the same file, a link to it, or a file with equal contents; - a
--secretor--read-secretfile the broker could not open: missing, not a regular file, not0600, not owned by you, outside~/.mur/secrets/, unreadable, empty, or too large; - an agent that can write anywhere inside or above
~/.mur/secrets/; --username,--secret,--read-username,--read-secretor--allow-unauthenticatedon afile://endpoint.
A --base-ref that is not a full ref is refused before any check, with a suggestion (did you mean refs/heads/main?).
https remotes
An https:// endpoint needs a login. Put the token in a file under ~/.mur/secrets/, readable only by you, and enroll with it:
mkdir -p ~/.mur/secrets && chmod 700 ~/.mur/secrets
( umask 077; printf '%s' "$TOKEN" > ~/.mur/secrets/github-app )
mur git-push enroll --agent coder --repo app --remote origin \
--endpoint https://github.com/acme/app.git \
--path ~/code/app \
--username x-access-token \
--secret "$HOME/.mur/secrets/github-app"
--secret must be an absolute path; pass "$HOME/…" so your shell expands it, because enroll expands nothing. The agent never sees the token: only the broker reads it.
The token is used before you approve, to read. To check a push, the broker first fetches the commits it builds on from the remote, as soon as the request arrives. On a private remote that fetch needs the login too, so the broker reads the token then and hands it to that read-only fetch. It reads the token again for the push itself, after your approval. Nothing is pushed before you approve. What this does mean: anyone who takes over the broker can read the repo without your approval. If that matters, enroll a separate read login (below), or at least give the broker a token scoped to this one repo, with no other permissions, and make it expire soon.
A separate read login
Add a second, read-only token and the broker opens only that one before approval. The push token is opened only for the push you approved:
( umask 077; printf '%s' "$READ_TOKEN" > ~/.mur/secrets/github-app-read )
mur git-push enroll --agent coder --repo app --remote origin \
--endpoint https://github.com/acme/app.git \
--username x-access-token --secret "$HOME/.mur/secrets/github-app" \
--read-username x-access-token --read-secret "$HOME/.mur/secrets/github-app-read"
mur only chooses which file is opened in each phase. It cannot see what the host lets a token do, so making the read token read-only on the host is up to you. Enroll never writes a secret, and refuses a read token that is the same as the push token.
Adding, changing or removing the read login is a policy change: pending pushes end as policy_changed. Each use of a token is recorded in the audit trail with the role that was selected: read and write for an enrollment with a read login, shared for one without. The role is which file was opened, not a check of the token's permissions.
mur git-push doctor notes an https enrollment that still uses one login for both phases, and prints the full mur git-push enroll … command to re-enroll it with a read login (your agent, repo, remote, endpoint, --ref-prefix and every --base-ref filled in, placeholders only for the new read login). It is a note, not a refusal: doctor still exits 0.
The token goes only to the enrolled host. It is sent only after that host asks for a login, so a public remote never receives it. Redirects are not followed. The token never appears in a status, an error message or a log. For a file:// remote, the broker reads no secret before approval.
A token the remote refuses is caught when the request arrives, not after you approve: the request is rejected with prefetch_rejected, and no approval is created. A secret file that has become unusable since you enrolled is rejected the same way, with credential_unreadable. With a read login, both checks apply to the read token only: the push token is not opened before approval, so a refused or unusable push token shows up only when the approved push runs.
An https endpoint with no credential is refused. A push without one fails on GitHub, GitLab and most other hosts, and it would fail only after you had approved it — approvals are never retried, so the agent would have to submit a new request for a fresh one. If your remote really does take anonymous pushes (for example an internal git-http-backend), say so:
mur git-push enroll --agent coder --repo app --remote origin \
--endpoint https://git.internal.example/app.git --allow-unauthenticated
mur git-push list shows as <username> for an https enrollment with a credential (plus reads as <read-username> when it has a read login) and unauthenticated for one without; --json adds credential: and read_credential: . The token itself is never printed.
What happens on a push
-
The agent calls
git_push_requestwith its own idempotency key, the repo and remote names, a ref under its namespace, and the old and new oids. The tool packs the commits, signs the request, drops it in~/.mur/agents/<agent>/inbox/git-push/, and returnspendingat once. -
murmurdverifies the signature against the agent's on-disk key (the agent id comes from the inbox path, never the payload), then checks the (agent, repo, remote) against your enrollments. The enrollments are re-read for each request, never cached. -
An accepted request is parked as
pending_approval, and a router-signed approval request appears on thegit-push-brokerchannel. -
You approve or deny that exact
(ref, old, new):mur channel approve git-push-broker <hitl-id> mur channel approve git-push-broker <hitl-id> --deny --reason "wrong branch" -
On approval the broker pushes. Status is written to
~/.mur/git-push/status/<agent>/<request_id>.yaml, which the agent reads withgit_push_status.git_push_cancelasks the broker to withdraw a request; it answerspending_cancel, the broker decides, and a push already executing cannot be recalled.
A pending request never times out. It waits until you answer, across daemon restarts.
Rejections
A request that is not accepted gets a status with a code:
| Code | Meaning |
|---|---|
agent_not_allowlisted | The agent is not in git_push.agents |
not_enrolled | No enrollment for that (agent, repo, remote) |
enrollment_unavailable | The enrollment records could not be read |
prefetch_rejected | The broker could not fetch what the push builds on, e.g. the remote refused the token |
credential_unreadable | An enrolled secret file (--secret or --read-secret) could not be opened, or holds an unusable token |
An approval can go stale
Every enrollment carries an epoch, stamped on the request when it is accepted and checked again just before the push. If you revoke or re-enroll in between, an allow you already gave ends as policy_changed and nothing is pushed.
outcome_unknown: the broker cannot tell whether the ref moved
outcome_unknown is a terminal status meaning the broker cannot vouch for what happened on the remote. It is reported when:
| Cause | Was anything sent? |
|---|---|
git timed out or was killed during the push | Maybe |
The daemon stopped while the push was executing; on restart the broker marks that request outcome_unknown | Maybe |
git did not start | No |
| Just before the push, the new oid is no longer a commit in the broker's copy, or the repo's control files changed since the request was accepted | No — the broker stops before running git |
The broker never retries a push, and the approval you gave stays spent: it is not replayed after a restart. To recover, check the remote yourself (for example git ls-remote <remote> <ref>). If the ref did not move and you still want the change, the agent has to submit a new request with a new idempotency key, which needs a fresh approval.
Manage enrollments
mur git-push list [--json] # active enrollments
mur git-push doctor [--json] # exit 1 if any enrollment would now be refused
mur git-push doctor --fix # regenerate registry.yaml from enrollments.yaml
mur git-push revoke --agent coder --repo app --remote origin
mur git-push repo move app --path ~/code/app-new # repoint a repo id
revoke removes one enrollment; a repo with none left is removed too. repo move voids every agent's pending pushes for that repo.
On disk
| Path | What |
|---|---|
~/.mur/git-push/private/enrollments.yaml | The enrollments: your source of truth |
~/.mur/git-push/registry.yaml | Repo id → directory and enrolled remote ids, derived from the enrollments. The daemon writes it, agents read it. Regenerated by doctor --fix |
~/.mur/git-push/status/<agent>/ | One status file per request |
~/.mur/agents/<agent>/inbox/git-push/ | Signed requests waiting for the daemon |