DVC Configuration
Once initialized in a project, DVC populates its installation
directory with internal files, which include .dvc/config, the default
configuration file.
Config files can be composed manually (or programmatically), or managed with the
helper command dvc config.
Config file locations
.dvc/config is meant to be tracked by Git and should not contain sensitive
user info or secrets (passwords, SSH keys, etc).
DVC supports saving configuration outside of the repository, either in a Git-ignored file alongside the regular config file or in other places in your file system. These locations and their loading priority are detailed below:
| Priority | Type | macOS location | Linux location (typical*) | Windows location |
|---|---|---|---|---|
| 1 | Local | .dvc/config.local | Same | Same |
| 2 | Project (default) | .dvc/config | Same | Same |
| 3 | Global | $HOME/Library/Application\ Support/dvc/config | $HOME/.config/dvc/config | %LocalAppData%\iterative\dvc\config |
| 4 | System | /Library/Application\ Support/dvc/config | /etc/xdg/dvc/config | %AllUsersProfile%\Application Data\iterative\dvc\config |
* For Linux, the global file may be found in $XDG_CONFIG_HOME, and the system
file in $XDG_CONFIG_DIRS[0], if those env vars are defined.
See also dvc config flags --local, --global, and --system.
Configuration sections
The following config sections are written by this command to the appropriate
config file (.dvc/config by default), supporting different config options
within:
core- main section with the general config optionsremote- sections in the config file that describe remote storagecache- options that affect the project's cachedb- sections in the config file that describe database connectionsexp- options around [experiments] configuration.hydra- options around Hydra Composition for experiment configuration.parsing- options around the parsing of dictionary unpacking.plots- options for configuringdvc plots.state- see Internal directories and files to learn more about the state database.studio- options for configuring DVC Studio tokenindex- see Internal directories and files to learn more about remote index files.
-
core.remote- name of the default remote storage -
core.interactive- whether to always ask for confirmation before reproducing each stage indvc repro. (Normally, this behavior requires using the-ioption of that command.) Accepts values:trueandfalse. -
core.analytics- used to turn off anonymized usage statistics. Accepts valuestrue(default) andfalse. -
core.checksum_jobs- number of threads for computing file hashes. Accepts positive integers. The default value ismax(1, min(4, cpu_count() // 2)). -
core.hardlink_lock- use hardlink file locks instead of the default ones, based onflock(i.e. project lock file.dvc/lock). Accepts valuestrueandfalse(default). Useful when the DVC project is on a file system that doesn't properly support file locking (e.g. NFS v3 and older). -
core.no_scm- tells DVC to not expect or integrate with Git (even if the project is initialized inside a Git repo). Accepts valuestrueandfalse(default). Set with the--no-scmoption ofdvc init(more details). -
core.check_update- disable/enable DVC's automatic update checks, which notify the user when a new version is available. Accepts valuestrue(default) andfalse. -
core.autostage- if enabled, DVC will automatically stage (git add) DVC files created or modified by DVC commands. The files will not be committed. Accepts valuestrueandfalse(default). -
core.site_cache_dir- specify a custom location for misc temporary files. Read more here.
Unlike most other sections, configuration files may have more than one
'remote'. All of them require a unique "name" and a url value. They can
also specify jobs, verify, and many platform-specific key/value pairs like
port and password.
See Remote Storage Configuration for more details.
For example, the following config file defines a temp remote in the local file
system (located in /tmp/dvcstore), and marked as default (via core
section):
['remote "temp"']
url = /tmp/dvcstore
[core]
remote = temp-
cache.dir- set/unset cache directory location. A correct value is either an absolute path, or a path relative to the config file location. The default value iscache, that resolves to.dvc/cache(relative to the project config file location).See also the helper command
dvc cache dirto intuitively set this config option, properly transforming paths relative to the current working directory into paths relative to the config file location. -
cache.type- link type that DVC should use to link data files from cache to the workspace. Possible values:reflink,symlink,hardlink,copyor an ordered combination of those, separated by commas e.g:reflink,hardlink,copy. Default:reflink,copyThere are pros and cons to different link types. Refer to File link types for a full explanation of each one.
If you set
cache.typetohardlinkorsymlink, manually modifying tracked data files in the workspace would corrupt the cache. To prevent this, DVC automatically protects those kinds of links (making them read-only). Usedvc unprotectto be able to modify them safely.To apply changes to this config option in the workspace, restore all file links/copies from cache with
dvc checkout --relink. -
cache.slow_link_warning- used to turn off the warnings about having a slow cache link type. These warnings are thrown bydvc pullanddvc checkoutwhen linking files takes longer than usual, to remind them that there are faster cache link types available than the defaults (reflink,copy– seecache.type). Accepts valuestrueandfalse.These warnings are automatically turned off when
cache.typeis manually set. -
cache.shared- permissions for newly created or downloaded cache files and directories. The only accepted value right now isgroup, which makes DVC use444(r—r—r—) for files and775(rwxrwxr-x) for directories. This is useful when sharing a cache among projects. The default permissions for cache files is system dependent. In Linux and macOS for example, they're determined usingos.umask.
Similar to remote, configuration files may have more than one 'db'. All of
them require a unique "name" and a url value which is a connection string to
connect to the database. They can also specify username and password
options, which is used to combine with provided url, which is what is passed
to the appropriate database drivers to connect to the database.
Set password to a Git-ignored local config file (.dvc/config.local) so that
no secrets are leaked through Git.
As an example, the following config file defines a pgsql database connection
to connect to the dbname database as a user user hosted at host url. The
postgresql:// defines a driver to be used to connect to that database.
['db "pgsql"']
url = "postgresql://user@host/dbnameThe name, pgsql for example, can be used to specify what database to connect
to, in commands like import-db.
Sets the defaults for experiment configuration.
exp.auto_push- push experiment automatically afterdvc exp runanddvc exp save. Accepts valuestrueandfalse(default).exp.git_remote- Git remote name or URL used to push experiment and [send live metrics and plots] to DVC Studio. Defaults toorigin.
Sets the defaults for experiment configuration via Hydra Composition.
hydra.enabled- enables Hydra config composition.hydra.config_dir- location of the directory containing Hydra config groups. Defaults toconf.hydra.config_name- the name of the file containing the Hydra defaults list (located insidehydra.config_dir). Defaults toconfig.yaml.hydra.plugins_path- location of the parent directory ofhydra_plugins, where Hydra will automatically discover plugins. Defaults to the root of the DVC repository.
-
parsing.bool- Controls the templating syntax for boolean values when used in dictionary unpacking.Valid values are
"store_true"(default) and"boolean_optional", named after Pythonargparseactions.Given the following
params.yaml:dict: bool-true: true bool-false: falseAnd corresponding
dvc.yaml:stages: foo: cmd: python foo.py ${dict}When using
store_true,cmdwill be:python foo.py --bool-trueWhereas when using
boolean_optional,cmdwill be:python foo.py --bool-true --no-bool-false -
parsing.list- Controls the templating syntax for list values when used in dictionary unpacking.Valid values are
"nargs"(default) and"append", named after Pythonargparseactions.Given the following
params.yaml:dict: list: [1, 2, 'foo']And corresponding
dvc.yaml:stages: foo: cmd: python foo.py ${dict}When using
nargs,cmdwill be:python foo.py --list 1 2 'foo'Whereas when using
append,cmdwill be:python foo.py --list 1 --list 2 --list 'foo'
-
plots.auto_open- iftrue, DVC will automatically open the HTML file generated bydvc plotscommands in a browser.falseby default -
plots.html_template- sets a custom HTML template fordvc plots. Accepts a path relative to the.dvc/folder. -
plots.out_dir- changes the default value fordvc plots show --outanddvc plots diff --out. The original default value isdvc_plots.
This section is obsolete since DVC 2.48.0. Modifying these config options will have no effect.
-
state.row_limit- maximum number of entries in state databases. This affects the physical size of the state files, as well as the performance of certain DVC operations. The default is 10,000,000 rows. The bigger the limit, the longer the file hash history that DVC can keep, for example. -
state.row_cleanup_quota- percentage of the state database to be deleted when it reaches thestate.row_limit. The default quota is 50%. DVC removes the oldest entries (created whendvc statusis used, for example). -
state.dir- specify a custom location for the state databases (links/andmd5/directories), by default in.dvc/tmp. This may be necessary when using DVC on NFS or other mounted volumes where SQLite encounters file permission errors.
-
studio.token- DVC Studio access token to use. When this is set, DVC uses this to share live experiments and notify Studio about pushed experiments. For security reasons, we advise setting token to either a local or a global config. This can also be specified throughDVC_STUDIO_TOKENenvironment variable, which will override any value instudio.token.Get the token or check this guide on how to create an access token.
-
studio.offline- Disables sharing live experiments even ifstudio.tokenis set or the token has been specified inDVC_STUDIO_TOKEN. Offline mode can also be specified throughDVC_STUDIO_OFFLINEenvironment variable, which will override any value instudio.offline. Accepts valuestrueandfalse. -
studio.url- URL of Studio to use (in case of self-hosted DVC Studio instance). This can also be specified throughDVC_STUDIO_URLenvironment variable, which will override any value instudio.url. If not set,https://studio.datachain.aiis used.