DVC "The following paths are ignored by your gitignore file" in CI
DVC needs to write and commit a .dvc pointer next to your data, but a broad .gitignore rule already ignores that path, so DVC cannot create a tracked pointer and stops.
What this error means
dvc add fails with "The following paths are ignored by your .gitignore file" listing the target path.
dvc
ERROR: bad DVC file name 'data/train.csv.dvc'. The following paths are ignored by
your .gitignore file: data/train.csv.dvcCommon causes
A broad gitignore rule covers the pointer
A rule like data/* ignores both the data and the .dvc pointer DVC needs to commit, blocking the add.
The .dvc extension is globally ignored
An overly wide ignore pattern matches *.dvc files, so DVC cannot track them.
How to fix it
Un-ignore the .dvc pointer
Add a negation so the pointer file is not ignored, while the raw data stays ignored.
.gitignore
data/*
!data/*.dvcNarrow the ignore rule
- Find the
.gitignorerule that matches the pointer path. - Scope it to the data file only, not the
.dvcpointer. - Re-run
dvc add.
Terminal
dvc add data/train.csvHow to prevent it
- Let DVC manage
.gitignoreentries rather than adding broad rules. - Keep
.dvcpointer files un-ignored so they can be committed. - Review
.gitignorewhen adding new DVC-tracked directories.
Related guides
DVC "output ... already tracked by git" in CIFix DVC "ERROR: output ... is already tracked by SCM (e.g. Git)" in CI - you tried to dvc add a path Git alre…
DVC data shows as Git "modified" and not committed in CIFix a dirty Git tree from DVC in CI - dvc add/repro updated .dvc pointers or dvc.lock that were not committed…
DVC "unable to read ... .dvc file" in CIFix DVC "ERROR: unable to read" a .dvc file in CI - a tracking file is corrupt, truncated, or was mangled by…