Use different SSH credentials

I’ve a server that handles multiple id_rsa keys for different repositories. Is there any way to set something like GIT_SSH_COMMAND before calling dvc command so I can authenticate with the correct private key? Currently this doesn’t seem to be supported by DVC.

You can configure which key to use per SSH remote by configuring the keyfile option. So you would just set the correct /path/to/repo-specific/id_rsa for each repo’s SSH remote. Please refer to the docs for dvc remote modify for more details: remote modify

This is the configuration to fetch the data right?. I’m having trouble cloning the git repo not pulling the data from the storage. As additional context, I’m using dvc get to avoid unnecessary steps like git clone.

Ah yes, my comment was specifically about fetching/pushing DVC data with SSH DVC remotes. For the dvc get clone step this is not currently supported, but I’ve opened an issue to add support for GIT_SSH_COMMAND which you can follow for updates: dulwich: use subprocess ssh vendor if GIT_SSH or GIT_SSH_COMMAND env vars are set · Issue #160 · iterative/scmrepo · GitHub


@mauricio this is fixed in our git dependency package, the fix will be available in the next DVC release. In the meantime, you can also use the fix if you install DVC in a Python virtualenv, and then install the updated dependency with

pip install scmrepo==0.1.5

(dvc must be installed first, as installing DVC will force pip to install the older scmrepo version that does not include the GIT_SSH_COMMAND support)