🔀 Fix Attributes Export-Ignore Missing From a Release Archive
Marking a path export-ignore in .gitattributes tells git archive to leave it out of the generated zip or tarball, which is exactly how most projects keep test fixtures, CI config, and internal docs out of a public release tarball — but that rule is read from the committed .gitattributes file at the commit or tag being archived, so a rule added only in a later commit has no effect on an archive generated from an older tag that predates it.
🔎 The Problem
.gitattributes (current HEAD): tests/ export-ignore .github/ export-ignore $ git archive --format=zip v2.3.0 -o release.zip # v2.3.0 was tagged BEFORE the export-ignore rules were added, # so tests/ and .github/ are still bundled into release.zip
✅ Fix: Backfill the Rule or Re-Tag, Don’t Just Update HEAD
- If the old tag can still be re-cut, add the
export-ignorerules, commit, and move the tag to point at the new commit —git archivereads attributes from the exact ref being archived, not from HEAD. - If the tag is already published and can’t move, generate that specific release’s archive manually with an explicit exclude list instead of trusting
git archiveto apply attributes the tagged commit never had. - Going forward, add export-ignore rules as part of the normal repository setup rather than as an afterthought, so every future tag inherits them automatically with no manual archive step needed.
Export-ignore isn’t a setting on your repository — it’s a fact about one specific commit, and git archive only ever reads it from the commit you’re actually archiving.




