Closed chrisdonlan closed 3 months ago
Under these conditions, I ignore the
data/
directory, except for any*.dvc
files within that directory.
Is there a reason you want to manually manage the gitignore file? In the scenario you describe, dvc should automatically update what gets gitignored for you, and it should match what you want here (the dvc-tracked data will be ignored but the .dvc files will be tracked).
Also, is there a reason you don't track all of data/
?
data/ !data/*.dvc !data/*/.dvc
You are completely ignoring the data/
directory here, including .dvc
files. See https://stackoverflow.com/a/67243109/3127500. You probably want something like this:
data/*
!data/*/
!data/*.dvc
Reproduce
1. dvc init 2. mkdir data 3. touch data/foo.txt 4. create the following gitignore file:
data/ !data/*.txt
5. `dvc add data/foo.txt` 6. `dvc push -r some-remote`
I'm unable to reproduce this. dvc add data/foo.txt
fails with the error ERROR: bad DVC file name 'data/foo.txt.dvc' is git-ignored.
This is the expected result, since as explained above, all of data/
is still ignored.
Bug Report
push: dvc push fails to push but WILL ADD and PULL (destroying existing data) under certain valid .
gitignore
configurationsDescription
DVC handles large files in directories I in general ignore:
Under these conditions, I ignore the
data/
directory, except for any*.dvc
files within that directory. DVC will not add any.dvc
files if they are ignored by.gitignore
, but will add them if I allow them via the everything-except pattern,!data/*.dvc
.However, even if those files are added and cached,
dvc
will not push them unless I removedata/
from.gitignore
.Reproduce
dvc add data/foo.txt
dvc push -r some-remote
Expected
I expected
dvc
to push the files to the remote. If Idvc pull
, all of my files being tracked by dvc but which are shadowed by the gitignore linedata/
will be destroyed. But if I push, nothing will be added to the remote.Environment information
Output of
dvc doctor
: