2

I just started with DVC. I have a git repo in which there are heavy models that i want to push to dvc. So I initialized the dvc by

dvc init

and then configured the bucket

dvc remote add -d storage s3://mybucket/dvcstore

Now there is /models folders, in which there was .gitkeep file and trained models. Following entry was in my .gitignore

*.tar.gz

I ran the following command

git rm -r --cached my_server\models

and added the following in the .gitignore

models

I want to add all the tar.gz files to push on dvc

so i tried

dvc add ./my_server/models/*.tar.gz

but this is showing

ERROR: bad DVC file name 'my_server\models\*.tar.gz.dvc' is git-ignored.

If I do dvc add ./my_server/models/

then this folder is added and a models.dvc file gets created. then git code shows for the changes.

what is the correct way, do i need to mention *.dvc to .gitignore as well?

Gert Arnold
  • 105,341
  • 31
  • 202
  • 291
Sunil Garg
  • 14,608
  • 25
  • 132
  • 189
  • 1
    Tags should be created [when there's a *very* good reason](https://stackoverflow.com/help/tagging). In this case, [dvc] gives you enough coverage. – Gert Arnold Sep 21 '21 at 15:10

2 Answers2

4

You can add

models/*
!models/*.dvc

to .gitignore to ignore other files in models/ except for .dvc files.

dvc add will automatically add the dvc tracked files to .gitignore

In most cases, you needn't to manage .gitignore you self.

karajan1001
  • 250
  • 2
  • 6
0

I added a git ignore for all file endings that aren't dvc (which were just 2 endings in my case).

So in your case I would create a .gitignore file in

./my_server/models/

with:

*.tar.gz
Alon Samuel
  • 356
  • 2
  • 8