Hi,
I have a crate which uses another crate placed on the private git repository on BitBucket. I use ssh-url in Cargo.toml
. When I try to build a crate (with cargo build
for instance) on Linux, everything works fine. But whenever I try to build it on Windows, it fails. The ssh keys are configured properly and I can pull external private repositories using git clone
, but when it comes to cargo build
it fails.
I tried to exectue a build from “Git Bash” (as it has ssh-agent.exe
and ssh-add.exe
) and I checked that ssh-add.exe -l
contains the proper key. I also tried to use “Rust Shell” (MSVC Shell and GNU Shell) to issue cargo build
. It always fails with an error:
Caused by:
failed to fetch into C:\Users\Daniel\.cargo\git\db\rust_utils-ce5321d34a8b1546
Caused by:
failed to authenticate when downloading repository
attempted ssh-agent authentication, but none of the usernames `git` succeeded
Caused by:
[23/-1] error authenticating: failed connecting agent
Has anyone had this issue? Could you suggest me something to fix the problem. I don’t know whether it is a cargo bug or if any additional configuration required.
UPD. I found a workaround/hack, it does not solve the problem and requires having Linux machine, but it may help you to build a project when it’s critical for you as it were for me. So basically what I did: I configured rustup
to use windows toolchain (mingw-64) and used crosscompilation to build a windows executable from my Linux machine (on Linux it works fine). Then I just executed cargo build --target=x86_64-pc-windows-gnu
on my Linux machine and it built the windows executable successfully.