Skip to main content

Description

The dvc init command initializes a DVC repository in a directory, creating the necessary DVC structure (.dvc directory and configuration files). This is typically the first command you run when starting to use DVC in a project.

Usage

Arguments

string
default:"."
Directory to initialize DVC in. Defaults to the current working directory.

Options

flag
Initiate DVC in directory that is not tracked by any SCM tool (e.g. Git).By default, DVC expects to be initialized in a Git repository. Use this flag to use DVC without Git.
flag
Overwrite existing .dvc/ directory. This operation removes local cache.
Using --force will delete your local cache. Make sure you’ve pushed important data to a remote before using this option.
flag
Necessary for running this command inside a subdirectory of a parent SCM repository.Allows you to initialize a DVC project in a subdirectory of a Git repository (monorepo structure).

Examples

Initialize in Current Directory

dvc init creates a .dvc directory with configuration files and adds them to .gitignore.

Initialize Without Git (Standalone)

This is useful when:
  • You’re using a different version control system
  • You want to use DVC for data management without version control
  • You’re in an environment where Git isn’t available

Reinitialize (Force)

--force will delete your local cache (.dvc/cache). Ensure you’ve run dvc push to backup data to a remote before forcing reinitialization.

Initialize in Subdirectory (Monorepo)

Useful for:
  • Monorepo projects with multiple sub-projects
  • Large repositories where only part needs DVC tracking
  • Separate data management for different components

What Gets Created

When you run dvc init, DVC creates the following structure:
And adds the following to your .gitignore:
.gitignore
The .dvc/ directory should be committed to Git (except for cache/ and other ignored items).

Post-Initialization Steps

1

Commit DVC files

2

Configure a remote (optional)

3

Start tracking data

Initialization Checks

Before initializing, verify:
(Skip if using --no-scm)
Use --force if you need to reinitialize.

Use Cases

New ML Project

Start tracking datasets, models, and experiments from day one.

Existing Project

Add data version control to an existing codebase.

Monorepo Setup

Use --subdir to enable DVC in part of a larger repository.

No-Git Workflow

Use --no-scm for DVC-only data management without version control.

Configuration After Init

After initialization, you may want to configure:

Cache Location

Analytics (Opt-out)

Autostage

Troubleshooting

Already Initialized Error

Solution: Use dvc init --force to reinitialize (note: this removes local cache).

Not a Git Repository Error

Solution: Either run git init first, or use dvc init --no-scm.

Permission Denied

Solution: Check directory permissions or run with appropriate privileges.
  • dvc add - Start tracking data files with DVC
  • dvc remote add - Configure remote storage
  • dvc config - Modify DVC configuration
  • dvc destroy - Remove DVC from project (opposite of init)