Skip to content

SSH tries to use default private key even if use_password is specified #10909

@harrystuart

Description

@harrystuart

Bug Report

Issue name

SSH tries to use default private key even if use_password is specified

Description

.dvc/config:

['core']
    remote = myserver

['remote "myserver"']
    url = ssh://myuser@mypublicip:/data
    ask_password = true

~/.ssh/config :

Nothing related to mypublicip.

When I run uv run dvc push:

$ uv run dvc push
Collecting                                                                                                                                                                                                                      |1.00 [00:00,  118entry/s]
PushingEnter a password for myuser@myserver:
# (I enter password here)
                                                                                                                                                                                                                                                         Enter passphrase for key '~/.ssh/id_ed25519': ent/files/md5'|                                                                                                                                                         |0/? [00:00<?,    ?files/s]
Enter passphrase for key '~/.ssh/id_ed25519': 
Enter passphrase for key '~/.ssh/id_ed25519': 
Pushing
Everything is up to date.  

You can see that I just press Enter when it tries to decrypt my private key, then gives up, but it works anyway because of course, the password I previously entered authenticates myuser and '~/.ssh/id_ed25519' has nothing to do with the host...

Reproduce

See above.

Expected

Asks for password to authenticate as myuser and doesn't ask me to unlock my default ssh key that doesn't even authenticate to mypublicip and is not listed in ~/.ssh/config

Environment information

I am using uv for my virtual env with the following pyproject.toml:

[project]
name = "project-name"
version = "0"
requires-python = ">=3.14"

dependencies = [
  "dvc[ssh]",
]

Output of dvc doctor:

DVC version: 3.63.0 (pip)
-------------------------
Platform: Python 3.14.0 on Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.39
Subprojects:
        dvc_data = 3.16.12
        dvc_objects = 5.1.2
        dvc_render = 1.0.2
        dvc_task = 0.40.2
        scmrepo = 3.5.3
Supports:
        http (aiohttp = 3.13.2, aiohttp-retry = 2.9.1),
        https (aiohttp = 3.13.2, aiohttp-retry = 2.9.1),
        ssh (sshfs = 2025.10.0)
Config:
        Global: ~/.config/dvc
        System: /etc/xdg/dvc
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/sdd
Caches: local
Remotes: ssh
Workspace directory: ext4 on /dev/sdd
Repo: dvc, git
Repo.site_cache_dir: /var/tmp/dvc/repo/2546558791564caae91c6453b68d4f38

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