# Pin a commit and fill source

> Get the address, the commit and the digest of a community chart from its git repository, without sending anything.

Your chart lives in a public git repository, and its `source` block must name the exact commit the store installs.

## Solution

Commit and push the chart's folder, then run `alta publish` on it:

```sh [Terminal]
git add my-chart && git commit -m "my-chart 0.2.0" && git push
alta publish my-chart
```

`alta publish` prints a `source` block. Paste it into `chart.json`, commit and push again. A finished block looks like this:

```json [chart.json]
{
  "git": "https://git.example.org/someone/alta-reading-log",
  "ref": "v0.2.0",
  "commit": "3f2c9a1e8b7d6c5f4e3d2c1b0a9f8e7d6c5b4a39",
  "sha256": "9c1e2a7f0b3d4e5f60718293a4b5c6d7e8f90112233445566778899aabbccdd0"
}
```

## How it works

`alta publish` is a dry run: it sends nothing, and it only runs git commands that read. It checks the folder with `alta lint`, then that the repository has no uncommitted change and that the current commit is on a remote branch, as git last fetched it. It prints the remote's https address, the full 40-character commit, the tag when the commit has one (`ref`), and the tree digest of the folder's files at that commit. Pinning the commit means the store installs exactly what you checked, even if the branch moves later.

When something is missing, it says what, and exits with 1:

```text [Output]
not ready (dry run: nothing sent)
  problem: my-chart is not in a git repository
  1. Nothing was sent. Fix the problems above, then run `alta publish` again.
```

## Variants

- **A tag.** Tag the commit (`git tag v0.2.0 && git push --tags`) before `alta publish`: the block gets `"ref": "v0.2.0"`.
- **A folder in a bigger repository.** Run it on the folder: the digest covers that folder only, and the output names it.
- **For a script.** `alta publish my-chart --json` prints the report as JSON (`alta.publish/1`).

**Next:**

- [Publish a chart](https://docs.altasystem.ai/marketplace/publish)
- [alta package](https://docs.altasystem.ai/reference/cli/package)
