---
title: "The CI build says version 0.0.0: the checkout fetched no tags | Proofline"
description: "A build that stamps its version with git describe needs the tag in the clone. The default actions/checkout fetches one commit without tags."
url: https://proofline.sh/learn/shallow-clone-git-describe-version/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# The CI build says version 0.0.0: the checkout fetched no tags

A build that stamps its version with git describe needs the tag in the clone. The default actions/checkout fetches one commit without tags. Then git describe fails, and a script that falls back to a placeholder or to --always keeps going. Before you trust a version string from CI, find the step that computed it and check that the tag was in the clone. Better, make the build fail when it is not.

Code review The Proofline team December 2, 2026 3 min read

## Why the tag is missing

The checkout action fetches "a single commit by default", and its `fetch-depth` input defaults to `1`. Its `fetch-tags` input defaults to `false`. Setting `fetch-depth: 0` fetches "all history for all branches and tags". [actions/checkout](https://github.com/actions/checkout#usage)

`git describe` names a commit by the nearest tag reachable from it. A clone of one commit without tags has nothing to describe from. Without `--tags`, it also considers only annotated tags. [git-describe](https://git-scm.com/docs/git-describe)

## Fixture: three ways the version comes out

Git 2.43.0. A repository has an annotated tag `v1.4.0` two commits behind `main`. A depth-1 clone of `main`:

```
$ git -C origin describe --tags
v1.4.0-2-g7aace73
$ git -C shallow describe --tags
fatal: No names found, cannot describe anything.
exit 128
$ git -C shallow describe --tags --always
7aace73
exit 0
$ git -C shallow rev-parse --is-shallow-repository
true
$ VERSION=$(git -C shallow describe --tags 2>/dev/null || echo 0.0.0-unknown); echo $VERSION
0.0.0-unknown
$ git -C shallow fetch -q --unshallow --tags && git -C shallow describe --tags
v1.4.0-2-g7aace73
```

The plain command fails loudly. The other two exit 0 with a version that names no release. `--always` is documented as "Show uniquely abbreviated commit object as fallback", so a bare hash in the version field means the fallback was used.

A second fixture checks out the tagged commit itself with `git fetch --no-tags --depth=1 origin +SHA:refs/remotes/origin/main`, the refspec the checkout action [builds for a branch push](https://github.com/actions/checkout/blob/main/src/ref-helper.ts). `git describe --tags` again failed with `No names found`, although the commit carries `v1.5.0`. Fetching `+refs/tags/*:refs/tags/*` made it print `v1.5.0`. A one-commit checkout does not get the tag even when that commit has one.

## Fetch what the version step needs

```
- uses: actions/checkout@v7
  with:
    fetch-depth: 0
- run: |
    test "$(git rev-parse --is-shallow-repository)" = false
    VERSION=$(git describe --tags --match 'v*')
```

`fetch-depth: 0` costs a full history fetch. Drop the fallback: without `|| echo`, a missing tag stops the job at the version step and never ships as `0.0.0`. On a tag push, the same source adds that tag's refspec, so the pushed tag is in the clone. There you can also take the version from [`GITHUB_REF_NAME`](https://docs.github.com/en/actions/reference/workflows-and-actions/variables), the tag's short name, and skip `git describe`.

## Read a version string as evidence

| Version you see | What produced it | What settles it |
| --- | --- | --- |
| `v1.4.0-2-g7aace73` | Tag found, two commits after it | `git rev-parse v1.4.0` in a full clone |
| `7aace73` alone | `--always` fallback, no tag in the clone | The checkout's depth and tags |
| `0.0.0`, `unknown`, `dev` | A script fallback | The build log of the version step |
| `v1.3.9-40-g…` | An older annotated tag; the newer tag is lightweight or not an ancestor | `git cat-file -t` on the newer tag, and `git merge-base --is-ancestor` |

The last row is the dangerous one, because the string looks plausible. A lightweight tag does not count without `--tags`, and a tag on a commit that the build does not descend from, such as a tag on a release branch, is not reachable. Either way, describe reaches back to an older annotated tag and the string still has the right shape. Compare the tag and commit in the version string with the release you meant to build.

Before you rely on a tag at all, see [protecting release tags](/learn/protect-release-tags/). For tags that name a tag object instead of a commit, read [peeling an annotated tag](/learn/annotated-tag-commit-peel/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [How do you stop a release tag from being moved or deleted?](/learn/protect-release-tags/)
    
    Code review The Proofline team November 23, 2026 4 min read
    
-   ### [Why does the release tag's SHA not match the commit CI tested?](/learn/annotated-tag-commit-peel/)
    
    Code review The Proofline team December 2, 2026 3 min read
