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.
tagging images: getting git commit: fatal: not a git repository
(or any of the parent directories): .gitCommon 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
- Ensure the checkout includes the .git directory (avoid a shallow export that strips it).
- If you use a shallow clone, fetch enough history for the tagger.
- Re-run so the gitCommit tagger can read the commit.
- uses: actions/checkout@v4
with:
fetch-depth: 0Use a tagger that does not need git
Switch to sha256 or an envTemplate whose variables you set in CI.
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.