Skip to content
Latchkey

GoReleaser "git doesn't contain any tags" in CI

GoReleaser computes the release version from the most recent git tag. The default GitHub Actions checkout is shallow with no tags, so GoReleaser sees an untagged repository and stops.

What this error means

GoReleaser exits immediately with "git doesn't contain any tags" or "get tag: ... fatal: No names found", even though the repository has tags on the remote.

Terminal
⨯ release failed after 0s
  error=git doesn't contain any tags. Either add a tag or use --snapshot

Common causes

The checkout has no tags

actions/checkout defaults to fetch-depth: 1 and does not fetch tags, so GoReleaser finds none in the local clone.

The workflow did not trigger on a tag

A push to a branch has no tag to release from; GoReleaser needs a tag ref (or --snapshot) to derive a version.

How to fix it

Fetch full history and tags in checkout

  1. Set fetch-depth: 0 on actions/checkout so the full history and all tags are present.
  2. Trigger the release job on tag pushes (on: push: tags).
  3. Re-run so GoReleaser can read the current tag.
.github/workflows/release.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0

Use --snapshot for untagged builds

For dry-run or branch builds without a tag, --snapshot fabricates a version so the build proceeds.

Terminal
goreleaser release --snapshot --clean

How to prevent it

  • Always set fetch-depth: 0 in the checkout step before GoReleaser.
  • Trigger release jobs on tag pushes, not branch pushes.
  • Use --snapshot for non-release CI runs that only test the build.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →