Use this page to find a command by task. For a guided first session, start with Get Started; for the daily loop, use Everyday commands.
Run agit <command> --help for the arguments supported by your installed
version. In the examples below, owner/repo@branch is an explicit AgentGit
session target. Replace placeholders with your own values. @ selects the
session supplied by AGIT_SESSION, which AgentGit sets when launching a runtime.
Install, sign in, and choose a repository
| Command | What it does |
|---|---|
agit login |
Sign in through the browser |
agit login --device |
Show a code for approval on another device |
agit login --with-token |
Read a personal access token from stdin |
agit logout |
Remove local credentials |
agit whoami |
Show the signed-in identity; --check verifies it online |
agit setup |
Install runtime integrations, skills, MCP, and project instructions |
agit config [key] [value] |
Read or set configuration |
agit status |
Show workspace binding, adopted sessions, and save/sync state |
agit init <name> |
Create a local AgentGit repository with its shared main file line |
agit clone <owner/repo> |
Download an existing Agent repository |
agit upgrade |
Check for or install a newer CLI |
Sign in from automation
When a browser or device-code flow is unsuitable, provide a Hub-issued token
through stdin. For example, if your CI secret store supplies AGIT_TOKEN:
printf '%s' "$AGIT_TOKEN" | agit login --with-token
agit whoami --check
Supply the token through the environment or another secret-store integration, and keep shell tracing disabled for this command. Do not put a token directly in the command line or in a tracked file.
Credentials are stored per Hub under ~/.agit/credentials/, including the
account identity and access/refresh tokens. agit login --hub https://hub.example.com
signs in to another Hub and remembers it as the default for later commands.
Use agit config hub.url to inspect that setting; AGIT_HUB_URL can override
it for an environment. Check the intended Hub before an automated publication.
Start, save, and continue sessions
| Command | What it does |
|---|---|
agit new <owner/repo> -b <branch> |
Create and launch an empty conversation inheriting shared files from main |
agit import |
Import through a terminal picker: select an inactive conversation and repository, then name a new branch |
agit import <session-id> --into <owner/repo@branch> --independent |
Adopt and save without selecting a prior session base |
agit commit <owner/repo@branch> |
Save new turns locally |
agit commit <target> --milestone "summary" --tag <tag> |
Save and label a completed phase |
agit resume <owner/repo@branch> |
Restore and continue an existing session branch |
agit run <owner/repo@ref> |
Fetch a reference and choose whether to resume or fork |
agit branch --repo <owner/repo> |
List or manage existing branches; use new or fork to create one |
Use new --as codex to select the runtime for a new conversation. Replace
codex with any launchable runtime identifier,
including openclaw, hermes, or workbuddy.
See default runtime selection
for configuring the choice used when --as is omitted.
Add --code to commit only when you also want a commit in the project’s
code repository. -m is for shared-file commits, not a conversation
milestone. agit commit saves locally; agit push publishes separately.
An import needs a lineage decision: use --independent for a no-base import,
or --onto <ref> to select an existing saved starting point. See
import lineage before
importing a conversation that continues earlier work. --yes does not choose
lineage. open --no-launch prepares a session without launching the runtime;
it changes local state and is not a dry run.
Review and share memory
| Command | What it does |
|---|---|
agit memory status --into <owner/repo@branch> |
Compare runtime, branch, and main memory |
agit memory diff [file] --into <owner/repo@branch> |
Inspect branch memory changes against main |
agit memory sync --into <owner/repo@branch> |
Collect runtime memory and refresh its branch mirror |
agit memory distill [file] --into <owner/repo@branch> |
Promote reviewed memory changes to main |
agit distill [file] --into <owner/repo@branch> |
Alias for memory distillation |
See Shared memory for collection boundaries and publication.
Read and search history
| Command | What it does |
|---|---|
agit log <owner/repo> --branches |
List session branches |
agit log <owner/repo@branch> [--oneline] |
Read saved turns and milestones |
agit show <ref> |
Render a conversation, turn, event, or file |
agit diff <left-ref>..<right-ref> |
Compare saved points |
agit view <ref> [--json] |
Inspect the selected context an agent receives |
agit search "query" |
Search readable hosted history; requires sign-in |
agit tag |
Name a saved point; see agit tag --help for forms |
agit export <ref> --format markdown |
Export a conversation to stdout or a file with -o |
See History and references for turn and event selectors and exports, and Search for scopes, filters, and batching.
Fork and reconcile work
| Command | What it does |
|---|---|
agit fork <ref> -b <branch> [--resume] |
Create a session branch from a saved conversation point |
agit merge <source> --into <target> |
Start an agent-assisted reconciliation |
agit merge <source> --into <target> --manual |
Start reconciliation without launching a merge agent |
agit merge --into <owner/repo@branch> --status |
Inspect the selected branch’s open merge transaction |
agit cherry-pick <ref#n..#m> --into <target> |
Add selected turns to a VIEW |
agit revert <ref#n.k> |
Remove an event from a VIEW while retaining evidence history |
agit pr create/list/show/fetch/merge |
Propose and review conversation branches on the Hub |
Follow Forks and merges for a complete merge or pull request workflow.
Publish, sync, and share
| Command | What it does |
|---|---|
agit push <owner/repo@branch> --dry-run |
Check and preview a publication |
agit push <owner/repo@branch> [--private|--public] |
Publish saved history; visibility flags apply on first publication |
agit pull <owner/repo@branch> |
Fetch and fast-forward where possible |
agit fetch <owner/repo> |
Fetch objects and remote refs without moving local branches |
agit clone <owner/repo> --mine |
Make a copy in your namespace |
agit repo list/info/path |
Find repositories, inspect metadata, or locate their local files |
agit repo visibility <owner/repo> <public|private> |
Change repository visibility through the required checks |
agit repo collab add/rm/list |
Manage collaborator grants |
agit repo invite <owner/repo> [--role read|write|owner] |
Print an invite link to the repository; read-only by default (0.2.5 or later) |
agit repo invite <owner/repo@branch> |
Print an invite link that opens that branch’s session after it is accepted |
agit share <session-id> |
Create a read-only conversation link |
agit share list · agit share rm <slug> |
List or revoke share links |
See Sharing and collaboration for visibility and access.
Invite links do not expire and can be used more than once; revoke them in the
repository’s Settings → Invite by link on the Hub. See
invite links.
agit repo --help also lists repository creation, rename, and deletion.
Diagnose and integrate
| Command | What it does |
|---|---|
agit scan |
Inspect history for secrets or sensitive content |
agit doctor [--check-backend] |
Check local integrity, runtime capabilities, and optionally Hub connectivity |
agit rc start --name <name> --detach |
Sign in if needed, start agitd, and enable inbound control for your account |
agit rc status/list/stop |
Inspect local status, list accessible Cloud devices, or stop this daemon |
agit rc revoke <device-id> |
Revoke a Cloud device credential |
agit rc grant/ungrant <workspace> <command> |
Delegate or take back operator approval of a command |
agit rc grants [workspace] |
Inspect command approval grants |
agit rc cloud status/devices --hub <hub> |
Inspect registration or discover devices |
agit rc cloud inbound --hub <hub> --enabled <true|false> |
Enable or disable inbound Cloud connections |
agit rc cloud policy |
Inspect the executor resource policy |
agit rc cloud grant --help |
Grant an account access to a machine, project, or session |
agit secrets add/list/status/remove |
Manage device-local secret records |
agit secrets review/allow/unallow/block |
Inspect or change repository-local protection |
agit mcp |
Run the local MCP server, normally registered by agit setup |
agit hooks |
Runtime-hook entry point installed by setup; normally not invoked manually |
Follow Remote Control for the complete browser workflow, Secret protection for vaults and scans, and Configuration for settings and upgrades. MCP and skills explains the agent integration.
Automation and structured output
Use an explicit target and request the common JSON envelope:
agit status --json
agit branch --repo alice/my-project --json
agit log alice/my-project@first-task --json
agit search "retry" --repo alice/my-project --json
The default envelope has schema: "cli-output", schema_version: 2,
command, ok, exit_code, result, diagnostics, and fix. Check ok and
the process exit code before dependent operations. If result.format is
json, use result.value; json_lines uses result.values, while text output
uses result.lines. Do not parse terminal tables as an API.
fix contains suggested typed recovery commands; they are alternatives to
review, not actions the CLI has executed. A required interactive choice returns
exit code 8. --yes does not invent a session target or choose import lineage.
Legacy parsers can explicitly request --json --json-version 1, whose envelope
does not include fix.
Use --no-tui for ordinary terminal output without full-screen navigation.
--json already suppresses the terminal interface. The mcp and hooks
integration commands own their own streams and do not use this envelope.
See Exit codes for failure categories.