You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I have multiple GitHub accounts (work and personal) on a single machine, I use SSH aliases to easily switch between the accounts when using various git commands. Up until now this has worked perfectly, even since using DVC in our repositories.
The main thing I use the aliases for is cloning without needing credentials. For example if I needed to clone a work GitHub repository I would run
git clone work:WorkAccount/repo.git
This works fine, and I can carry on working on the code as normal, with all git commands and DVC commands functioning as expected, all except for dvc exp pull.
If a git repository has been set up with SSH using an alias, then dvc exp pull origin -A (or any experiment name/origin name) will crash with the following output (Where the SSH alias in this example is github):
ERROR: unexpected error - Git failed to fetch ref from 'origin': failed to resolve address for github: nodename nor servname provided, or not known
This behavior is only applicable to dvc exp pull. dvc exp push and dvc exp list both work as expected when the repository is set up with an ssh alias to the remote location, for example the .git/config has the following:
Clone a DVC repo using git clone alias:iterative/example-get-started.git where alias is github in our above description, and should match whatever is set in ~/.ssh/config when you set up SSH with GitHub (Step 1).
cd example-get-started
dvc exp pull origin -A
DVC crashes with the following error
ERROR: unexpected error - Git failed to fetch ref from 'origin': failed to resolve address for github: nodename nor servname provided, or not known
Also tested on older versions of DVC (> 3) and latest DVC version
As mentioned above dvc exp push and dvc exp list both work as expected with an SSH alias
Workaround
When adding the relevant reproducibility notes to this issue, I noticed that in the gist I linked for setting up SSH for multiple accounts, they clone with:
git clone git@alias:GitAccount/repo.git
Which adds a git@ portion to the URL, and when I tried this, it did in fact fix the issue I was facing. However, while this is a fix, I'm still posting the issue in case there is actually a bug in place, as the git@ was not required for any other Git or DVC commands to function properly.
The text was updated successfully, but these errors were encountered:
Setting the user in the git URL shouldn't be required since you are using the User field in your ssh config host section. There's a bug somewhere but given that there's a simple workaround for now we probably won't prioritize this issue right away
I think the issue here is actually that the dulwich protocol check looks for the explicit (http|git| ssh):// scheme or git@ prefix to determine which client to use. In this case you can configure an ssh host that doesn't use the ssh:// or git@ prefix at all and just uses github:... (where github is the ssh config host alias). Will have to take a look at what cli git actually does here to determine whether or not the github:... should be treated as a local path or as a URL
Bug Report
Description
As I have multiple GitHub accounts (work and personal) on a single machine, I use SSH aliases to easily switch between the accounts when using various git commands. Up until now this has worked perfectly, even since using DVC in our repositories.
The main thing I use the aliases for is cloning without needing credentials. For example if I needed to clone a work GitHub repository I would run
git clone work:WorkAccount/repo.git
This works fine, and I can carry on working on the code as normal, with all git commands and DVC commands functioning as expected, all except for
dvc exp pull
.If a git repository has been set up with SSH using an alias, then
dvc exp pull origin -A
(or any experiment name/origin name) will crash with the following output (Where the SSH alias in this example isgithub
):ERROR: unexpected error - Git failed to fetch ref from 'origin': failed to resolve address for github: nodename nor servname provided, or not known
This behavior is only applicable to
dvc exp pull
.dvc exp push
anddvc exp list
both work as expected when the repository is set up with an ssh alias to the remote location, for example the.git/config
has the following:and
.ssh/config
contains for example:and
~/.ssh/github
has been set up correctly for ssh access to GitHub.If the
.git/config
file is edited as follows:then
dvc exp pull
works as expectedReproduce
git clone alias:iterative/example-get-started.git
wherealias
isgithub
in our above description, and should match whatever is set in~/.ssh/config
when you set up SSH with GitHub (Step 1).cd example-get-started
dvc exp pull origin -A
.git/config
and changeto
dvc exp pull origin -A
and it will pull all experiments as expectedExpected
DVC to pull all experiments from the remote repository without any error when using an SSH alias
Environment information
Output of
dvc doctor
:Additional Information (if any):
dvc exp push
anddvc exp list
both work as expected with an SSH aliasWorkaround
When adding the relevant reproducibility notes to this issue, I noticed that in the gist I linked for setting up SSH for multiple accounts, they clone with:
git clone git@alias:GitAccount/repo.git
Which adds a
git@
portion to the URL, and when I tried this, it did in fact fix the issue I was facing. However, while this is a fix, I'm still posting the issue in case there is actually a bug in place, as thegit@
was not required for any other Git or DVC commands to function properly.The text was updated successfully, but these errors were encountered: