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.
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.
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.
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.