Skip to content
Latchkey

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

Common 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/*.dvc

Narrow the ignore rule

  1. Find the .gitignore rule that matches the pointer path.
  2. Scope it to the data file only, not the .dvc pointer.
  3. Re-run dvc add.
Terminal
dvc add data/train.csv

How to prevent it

  • Let DVC manage .gitignore entries rather than adding broad rules.
  • Keep .dvc pointer files un-ignored so they can be committed.
  • Review .gitignore when adding new DVC-tracked directories.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →