---
url: /share/publishing.md
---
# Git, registries, and package files

Each channel takes a different step from you and gives others a different way in:

| Channel | You | Others | It needs |
| --- | --- | --- | --- |
| Git repository | Commit `pandra.toml`, `pandra.lock`, and the local files they refer to, and `git push` ([Git](#sharing-through-git)). | `pandra run` or `pandra pull` of `github.com/acme/agents/reviewer@v1.2.0`. | Read access to the repository, from Git's own credentials. |
| OCI registry | `pandra push ghcr.io/acme/reviewer` in the project ([registry](#publishing-a-package-to-an-oci-registry)). | `pandra run` or `pandra pull` of `ghcr.io/acme/reviewer:1.2.0`. | Write access to the registry ([credentials](#registry-credentials)). The tag is the `version` in the project's `pandra.toml`. Others need no login to pull from a public registry. |
| Package file | `pandra build -o reviewer.agent.tar` or `pandra agent save` ([files](#package-files)). | `pandra agent load`, or `pandra run ./reviewer.agent.tar`. | Nothing: you hand the file over by any means. |

The same content builds to the same digest, so a package from any channel can be compared with another by its digest.

## Share through Git {#sharing-through-git}

### Name an agent in a repository

A repository can hold several agents in their own directories. Others name an agent by its repository and directory, with an optional `@ref`:

```sh
# the default branch
pandra run github.com/acme/agents/reviewer --prompt "Review my changes."
# a tag, a branch, or an exact commit
pandra pull github.com/acme/agents/reviewer@v1.2.0
pandra pull github.com/acme/agents/reviewer@main
pandra pull github.com/acme/agents/reviewer@<full-commit>
```

| Where the agent is | Reference |
| --- | --- |
| In a repository on `github.com`, `bitbucket.org`, or `codeberg.org` | `github.com/acme/agents/reviewer@v1.2.0` |
| At the root of its repository | `github.com/acme/reviewer@v1.2.0` |
| On `gitlab.com`, where `//` ends the repository, because groups nest | `gitlab.com/acme/tools/agents//reviewer@v1.2.0` |
| On a self-hosted server, which needs a scheme; without `//`, the whole path is the repository | `https://git.example.com/team/agents.git//reviewer@v1.2.0` |
| Over SSH | `ssh://git@git.example.com/team/agents.git//reviewer@v1.2.0` |

The ref is what follows the last `@`, so a branch name can contain `/`.

### Keep the lockfile committed

Pandra builds the package from the project's lockfile without running any agent code, and `pull` never changes the lockfile. So when the definition has external sources, commit `pandra.lock` and keep it up to date, or others get an error:

```text
$ pandra pull github.com/acme/agents/reviewer@v2
error: pandra.lock is missing, and pandra.toml has sources it pins; the project's author has to update pandra.lock
  pandra.lock has no entry for [skills.lint]
```

### Share agents that build on one base

A project's local paths can lead anywhere inside its repository, so agents side by side can share skills or a [base](/build/base.md#agents-that-share-a-repository). In this repository, `reviewer` and `developer` both name `../base` as their base:

```text
github.com/acme/agents
├── base/
│   ├── pandra.toml       the shared core
│   ├── pandra.lock
│   └── instructions.md
├── reviewer/
│   ├── pandra.toml       [base] path = "../base"
│   ├── pandra.lock
│   └── instructions.md
└── developer/
    ├── pandra.toml       [base] path = "../base"
    ├── pandra.lock
    └── instructions.md
```

Whoever runs `github.com/acme/agents/reviewer` gets `base/` from the same commit. A pull therefore reads the whole repository at that commit, so publish an agent that lives in a large repository to a [registry](#publishing-a-package-to-an-oci-registry) instead.

To change someone else's agent, name it as the [base](/build/base.md) of your own project; a change that does not alter what the agent is, such as the model or secrets, goes in your [configuration](/configure.md). Pandra does not fetch Git LFS objects or submodules, so a project that needs them fails instead of being built incomplete.

### Private repositories

Pandra fetches Git sources with your `git` command, so your credential helpers and SSH keys apply as they do for `git clone`, except that Git never prompts. [Network and Git access](/reference/network.md) says what to set up first, and how Pandra uses proxies and certificates.

## Share through an OCI registry

An [OCI registry](https://github.com/opencontainers/distribution-spec) is the kind of server that stores Docker images, such as ghcr.io or Docker Hub. It also stores built agent packages, each with a version tag and a digest.

### Push a package {#publishing-a-package-to-an-oci-registry}

Pushing needs a [SemVer](https://semver.org) `version` in `pandra.toml`, such as `1.2.0`, and write access to the registry. If you signed in with `docker login`, Pandra uses that login; otherwise, see [registry credentials](#registry-credentials). To push the project in the current directory:

```sh
pandra push ghcr.io/acme/reviewer
```

```text
Pushed reviewer 1.2.0
  From:    /home/me/agents/reviewer
  To:      ghcr.io/acme/reviewer:1.2.0
  Digest:  sha256:4f2a9c1e7b3d5a6f8e0c1b2a3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f67
```

When the package cannot record the repository and commit it was built from, `pandra push` warns first and says why, such as for a repository with no remote:

```text
warning: the package records no source repository: no remote has a URL that a package can record
```

A changed or untracked file that the package holds, such as `pandra.lock`, also keeps the source out: commit it and push again.

`pandra push` builds the project from its lockfile and takes no project path: to push another project, run it in that project's directory. Without a tag, the `version` is the tag; `ghcr.io/acme/reviewer:latest` pushes the tag as given, and Pandra never adds `latest` for you. A version with build metadata, such as `1.2.0+build.5`, needs a tag you choose, because OCI tags cannot contain `+`. Pushing to a tag that exists moves it, as `docker push` does. People who run or pull your agent always name a tag or a digest.

`--from AGENT` pushes a package from your [store](/share/pulling.md#managing-your-store) instead. Name it by local name, digest, OCI reference, or Git reference, so you can push a package you built, publish an agent you pulled from Git, or copy one between registries. It takes only what your store holds, so bring a reference or a package file in with `pandra pull` or `pandra agent load` first:

```sh
pandra push ghcr.io/acme/reviewer:1.2.0 --from reviewer
pandra pull ghcr.io/acme/reviewer:1.2.0
pandra push registry.example.com/team/reviewer:1.2.0 --from ghcr.io/acme/reviewer:1.2.0
```

Pushing writes nothing to your store and approves nothing, so to try a project, run it with `pandra run .`. `push` attaches no signature or attestation and copies none from another registry; sign the pushed digest with another tool, such as `cosign sign`, if you need to.

### Registry credentials {#registry-credentials}

`pandra auth` manages the credentials Pandra itself uses to pull and push; values for agents go in `pandra config` instead:

```sh
# asks for the username and a hidden password
pandra auth login registry.example.com
echo "$TOKEN" | pandra auth login ghcr.io -u me --password-stdin
# a registry on a Git host
pandra auth login oci://codeberg.org
pandra auth status
pandra auth logout registry.example.com
```

`login` checks the credentials with the registry, so it needs the network and stores nothing the registry rejects. It stores them in a file in Pandra's data directory that only you can read. Pandra never accepts a password as an argument. For each registry, Pandra uses the first of these:

1. Its own credentials, from `pandra auth login`.
2. Docker-compatible credentials (`DOCKER_CONFIG` or `~/.docker/config.json`, credential helpers included), so `docker login` and CI login steps work without Docker installed.
3. Anonymous access, which is all a public registry needs to pull.

`pandra auth status` lists where each registry's login comes from, without contacting the registries or printing secrets:

```text
$ pandra auth status
codeberg.org   Pandra's file (user alice)
ghcr.io        Docker credential helper desktop
Docker credential helpers configured with credsStore may cover hosts not listed here
```

`logout` removes only Pandra's own credentials, and hands the registry back to Docker's. To override a wrong Docker login without changing Docker's setup, store a login in Pandra with `pandra auth login HOST`. When a registry refuses a login, the error says which login Pandra used and gives the step that signs in again: `pandra auth` for a login stored in Pandra, `docker login` for one from Docker. Pandra never retries anonymously by itself:

```text
$ pandra pull ghcr.io/acme/reviewer:1.2.0
error: ghcr.io rejected the login stored in Pandra (it may have expired or been revoked); if the package is public, `pandra auth logout ghcr.io` removes that login to pull it anonymously
  To sign in again:
    pandra auth login ghcr.io
```

Some registries, such as ghcr.io and Docker Hub, answer "not found" for a private package when you are not signed in, so a "not found" error offers `pandra auth login`. Pandra sends registry credentials only over HTTPS, to the registry and the token service it names, never follows a redirect to another host with them, and never passes its credentials to agents, harnesses, or MCP servers. Plain HTTP is used only for registries on `localhost`, `127.0.0.0/8`, or `[::1]`.

## Share a package file {#package-files}

A package file holds one package in a single `.agent.tar` file, with the same digest it has in a registry. `pandra agent save` and `pandra agent load` move packages between your store and files, as `docker save` and `docker load` do.

### Write a package file

Either command writes the file. `pandra build -o` builds a local project into it, and `pandra agent save` writes a package from your store:

```sh
pandra build -o reviewer.agent.tar
pandra agent save ghcr.io/acme/reviewer:1.2.0 -o reviewer.agent.tar
```

### Load and run a package file

Whoever receives the file loads it into their store, approves it, and runs it, in this order:

```sh
pandra agent load ./reviewer.agent.tar --name reviewer
pandra agent trust reviewer
pandra run reviewer --prompt "Review PR 12."
```

A loaded package gets the name in its manifest when that name is free, or the one you give with `--name`. `pandra agent save` writes a tag into the file only when AGENT is an OCI reference with a tag. You can also run a file without loading it, as `pandra run ./reviewer.agent.tar`; its settings are then keyed by the file's absolute path.

A package file someone gives you needs your approval before it runs, whether you load it or run it directly. Pandra cannot tell where a file came from, so the approval covers that exact package only, and a file whose content changes asks again. A package file is an OCI image layout, so other tools that read OCI layouts can read it too ([package files](/reference/agent-package.md#package-files)).
