Skip to content
Latchkey

Skaffold "tagging failed" in CI

After building, Skaffold applies its tag policy (gitCommit, sha256, envTemplate, dateTime) to name the image. If the policy cannot compute a value, tagging fails before the push.

What this error means

A build fails during the tag phase with "tagging images: ..." naming the tagger, for example a gitCommit tagger error on a checkout with no git metadata.

skaffold
tagging images: getting git commit: fatal: not a git repository
(or any of the parent directories): .git

Common causes

The gitCommit tagger has no git history

A CI checkout without the .git directory (or a tarball export) leaves the gitCommit tagger unable to read a commit.

An envTemplate references an unset variable

The envTemplate tagger expands an environment variable that CI never set, so the tag cannot be built.

How to fix it

Provide git history for gitCommit tagging

  1. Ensure the checkout includes the .git directory (avoid a shallow export that strips it).
  2. If you use a shallow clone, fetch enough history for the tagger.
  3. Re-run so the gitCommit tagger can read the commit.
.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0

Use a tagger that does not need git

Switch to sha256 or an envTemplate whose variables you set in CI.

skaffold.yaml
build:
  tagPolicy:
    sha256: {}

How to prevent it

  • Keep git history in the CI checkout when using gitCommit tags.
  • Set any env vars an envTemplate tagger references.
  • Prefer sha256 tagging when git metadata is unreliable.

Frequently asked questions

What causes ""tagging images failed""?
A CI checkout without the .git directory (or a tarball export) leaves the gitCommit tagger unable to read a commit.
How do I fix "tagging images failed"?
Provide git history for gitCommit tagging

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card