Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo run is failing with "failed to set hostkey preference: The requested method(s) are not currently supported; class=Ssh" #14617

Open
fabioz opened this issue Sep 30, 2024 · 4 comments
Labels
A-git Area: anything dealing with git C-bug Category: bug S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

Comments

@fabioz
Copy link

fabioz commented Sep 30, 2024

Problem

I was trying to build the zed editor following instructions from: https://github.com/zed-industries/zed/blob/main/docs/src/development/windows.md

When I get to the cargo run phase the process fails with the message below:

λ cargo run
    Updating crates.io index
    Updating git repository `https://github.com/kvark/blade`
error: failed to get `blade-graphics` as a dependency of package `gpui v0.1.0 (X:\zedws\zed\crates\gpui)`

Caused by:
  failed to load source for dependency `blade-graphics`

Caused by:
  Unable to update https://github.com/kvark/blade

Caused by:
  failed to fetch into: C:\Users\<username>\.cargo\git\db\blade-b2bcd1de1cf7ab6a

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  failed to set hostkey preference: The requested method(s) are not currently supported; class=Ssh (23)

I can manually git clone that repository:

λ git clone  https://github.com/kvark/blade
Cloning into 'blade'...
remote: Enumerating objects: 5129, done.
remote: Counting objects: 100% (895/895), done.
remote: Compressing objects: 100% (380/380), done.
remote: Total 5129 (delta 604), reused 557 (delta 512), pack-reused 4234 (from 1)
Receiving objects: 100% (5129/5129), 5.00 MiB | 4.02 MiB/s, done.
Resolving deltas: 100% (3287/3287), done.

But I don't know why cargo can't (which makes the build fail). I tried changing the cargo toml from ssh to https so that it becomes:

blade-graphics = { git = "ssh://git@github.com/kvark/blade" }

But it still fails with a very similar message:

 λ cargo run
    Updating crates.io index
    Updating git repository `ssh://git@github.com/kvark/blade`
error: failed to get `blade-graphics` as a dependency of package `gpui v0.1.0 (X:\zedws\zed\crates\gpui)`

Caused by:
  failed to load source for dependency `blade-graphics`

Caused by:
  Unable to update ssh://git@github.com/kvark/blade

Caused by:
  failed to fetch into: C:\Users\fabio\.cargo\git\db\blade-88a49619c2e97d2a

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  failed to set hostkey preference: The requested method(s) are not currently supported; class=Ssh (23)

Steps

Follow the steps from https://github.com/zed-industries/zed/blob/main/docs/src/development/windows.md on Windows

Possible Solution(s)

No response

Notes

I'm on Windows. The git version on the system is:

set git
git_executable=C:\Program Files\Git\cmd\git.exe
GIT_INSTALL_ROOT=C:\Program Files\Git
git_locale="C:\Program Files\Git\usr\bin\locale.exe"
GIT_SSH=PLINK.exe
GIT_VERSION_USER=2.39.0.windows.1

I tried unsetting GIT_SSH and it didn't make any difference (not sure if cargo actually uses my system git -- probably not otherwise it'd probably work).

I don't really have any proxies that need to be set.

Version

λ cargo version --verbose
cargo 1.81.0 (2dbb1af 2024-08-20)
release: 1.81.0
commit-hash: 2dbb1af
commit-date: 2024-08-20
host: x86_64-pc-windows-msvc
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.8.0-DEV (sys:0.4.73+curl-8.8.0 vendored ssl:Schannel)
os: Windows 10.0.22631 (Windows 11 Professional) [64-bit]

@fabioz fabioz added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Sep 30, 2024
@epage
Copy link
Contributor

epage commented Sep 30, 2024

Did you try the suggested workaround? What is the result?

Caused by: network failure seems to have happened if a proxy or similar is necessary `net.git-fetch-with-cli` may help here https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli 

We use libgit2 for most operations but allow overriding that with git in for fetch operations.

Do you have any special configuration in your .gitconfig or any unusual network setup?

@epage epage added the A-git Area: anything dealing with git label Sep 30, 2024
@weihanglo
Copy link
Member

Might be related libgit2/libgit2#6612

@fabioz
Copy link
Author

fabioz commented Sep 30, 2024

It's weird, I tried (in Windows) to add the config file to %USERPROFILE%\.cargo\config.toml with:

[net]
git-fetch-with-cli = true   # use the `git` executable for git operations

And it didn't work (I even double-checked that pasting that to the explorer opens the proper file).

Now, after trying with cargo --config net.git-fetch-with-cli=true run it did work, so, it seems that for some reason it's not picking up the cargo config, but at least I now have a workaround ;)

Do you have any special configuration in your .gitconfig or any unusual network setup?

I cleared my .gitconfig (except for the [user]) and got the same results and I don't think there's anything unusual in my network setup.

Might be related libgit2/libgit2#6612

In the comments there's an issue that's exactly the same as mine: libgit2/libgit2#6612 (comment) (using cargo too, but no dice on the fix or reason).

@weihanglo weihanglo added S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix and removed S-triage Status: This issue is waiting on initial triage. labels Sep 30, 2024
@weihanglo
Copy link
Member

Yeah, it seems like an upstream issue in libssh2: libgit2/libgit2#6612 (comment).

In order to track the process in upstream, I'll keep this open and marked as S-blocked-external.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-bug Category: bug S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Projects
None yet
Development

No branches or pull requests

3 participants