Skip to content

add: command line response suggests invalid syntax with single quotes #11134

Open

Description

@samhaese

Bug Report

add: command line response suggests invalid syntax with single quotes

Description

The response from dvc add puts single quotes around the added files in the tracking command. Copying and pasting that command doesn't work (on Windows).

Reproduce

  1. dvc init
  2. dvc get https://github.com/treeverse/dataset-registry get-stared/data.xml -o data/data.xml
  3. dvc add data/data.xml
  4. Copy the recommended command for tracking changes with git
  5. Run the recommended command for tracking changes with git

Output of step 3:

To track the changes with git, run:

        git add 'data\data.xml.dvc' 'data\.gitignore'

To enable auto staging, run:

        dvc config core.autostage true

Output of step 5:

>git add 'data\data.xml.dvc' 'data\.gitignore'
fatal: pathspec ''data\data.xml.dvc'' did not match any files

Expected

Output of step 3:

To track the changes with git, run:

        git add data \data.xml.dvc data\.gitignore

To enable auto staging, run:

        dvc config core.autostage true

Output of step 5:

>git add data\data.xml.dvc data\.gitignore
>

Environment information

Output of dvc doctor:

DVC version: 3.67.1 (pip)
-------------------------
Platform: Python 3.14.7 on Windows-11-10.0.26200-SP0
Subprojects:
        dvc_data = 3.18.3
        dvc_objects = 5.2.0
        dvc_render = 1.0.2
        dvc_task = 0.40.2
        scmrepo = 3.6.2
Supports:
        http (aiohttp = 3.14.5, aiohttp-retry = 2.9.1),
        https (aiohttp = 3.14.5, aiohttp-retry = 2.9.1)
Config:
        Global: C:\Users\sdhaese\AppData\Local\iterative\dvc
        System: C:\ProgramData\iterative\dvc
Cache types: hardlink
Cache directory: NTFS on C:\
Caches: local
Remotes: None
Workspace directory: NTFS on C:\
Repo: dvc, git
Repo.site_cache_dir: C:\ProgramData\iterative\dvc\Cache\repo\4c6eddb13bce22146e932db9a1327740

Additional Information (if any):

Activity

  1. Rudra-G-23 commented on Nov 6, 2026

    @Rudra-G-23

    Hi, I'd like to work on this issue. I traced the behavior to SCMContext._make_git_add_cmd(), which uses shlex.quote() to format paths.

    I can add Windows-compatible quoting while preserving Unix behavior, along with regression tests for paths containing spaces and backslashes.

    Should the Windows output specifically target CMD, or should PowerShell compatibility also be considered?

  2. Rudra-G-23 commented on Nov 13, 2026

    @Rudra-G-23

    I raised the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions