Safeguard
Developer Tools•

Where do DVC remote credentials go, and what stays out of Git?

DVC keeps shared remote settings in a committed config and sensitive ones in a Git-ignored local file. How the local flag works and a review checklist.

Safeguard Security Team
3 min read

Put the remote URL in the committed DVC config and put anything sensitive in the Git ignored local config by adding the local flag to the modify command. DVC's documentation says that flag is needed to write sensitive user information to a Git ignored file, so that no secrets are leaked.

Two config files, two jobs

DVC splits settings across files. The shared file, .dvc/config, is committed so a team shares the remote location. The local file, .dvc/config.local, is Git ignored and holds values that belong to one person or one machine.

The docs give an example in which the dvc remote modify command, with the local flag, writes a credential path to the local file, while the remote URL and a setting like connect_timeout go to the shared file. Because the local file is not committed, the docs note that each copy of the repository must configure these values separately.

Why this matters for data science repos

Data versioning repos hold pointers to large datasets, and the remote is where the real data lives. If a key to that remote lands in Git, it lands in history, forks and clones, and removing it from the latest commit does not remove it from history. A leaked key to a bucket holding training data is a data incident, not just an inconvenience.

What goes where

SettingFileCommitted
Remote name and URL.dvc/configYes
Timeout and other non-sensitive options.dvc/configYes
Credential path, keys, tokens.dvc/config.localNo
Anything personal to one developer.dvc/config.localNo

The documentation says the local file is added to .gitignore. Check that your repository actually ignores it, because a repo created by hand may differ.

Better than a key in a file

A file with a long lived key is still a secret on a laptop. Where your storage supports it, prefer short lived credentials from your cloud identity tooling, and let the config point at a profile or a path rather than hold the key itself. The example above stores a path to a credentials file, not the key itself.

Review checklist

  1. Run a search of the repository history for key patterns before you assume it is clean.
  2. Confirm .dvc/config.local is ignored in .gitignore.
  3. Make sure the shared config has no access keys, secret keys or tokens.
  4. Document how a new teammate gets their credentials, so nobody pastes a shared key into chat.
  5. Rotate any credential that ever appeared in a commit.
  6. Give each person or job the smallest access to the remote that works, read only where possible.
  7. Add a secret scanning step to your pull request checks.

For notebook specific habits, see keep API keys out of notebooks.

Safeguard's scanning and policy gates can help catch exposed secrets and risky changes in pull requests. Try the free scan at gold.safeguard.sh/scan.

Quick check

Is the DVC config file safe to commit?

The shared config is meant to be committed, so keep sensitive values out of it and in the local file.

I committed a key once and deleted it. Am I fine?

No. It remains in history. Rotate the credential.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.