在使用货物时,我们非常熟悉以下错误。
[ERROR rust_analyzer::lsp_utils] rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /Users/calvin/tiflash/raft-engine/Cargo.toml, Some(Version { major: 1, minor: 64, patch: 0, pre: Prerelease("nightly") }): Failed to run `"cargo" "metadata" "--format-version" "1" "--manifest-path" "/Users/calvin/tiflash/raft-engine/Cargo.toml" "--filter-platform" "x86_64-apple-darwin"`: `cargo metadata` exited with an error: Updating git repository `https://github.com/pingcap/rust-protobuf`
Updating git repository `https://github.com/tikv/raft-rs`
error: failed to load source for dependency `raft-proto`
Caused by:
Unable to update https://github.com/tikv/raft-rs?branch=master
Caused by:
failed to fetch into: /Users/calvin/.cargo/git/db/raft-rs-42b8049ef2e3af07
Caused by:
failed to authenticate when downloading repository: git@github.com:tikv/raft-rs
* attempted ssh-agent authentication, but no usernames succeeded: `git`
if the git CLI succeeds then `net.git-fetch-with-cli` may help here
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
Caused by:
no authentication available通过使用以下命令,可以解决问题
eval `ssh-agent -s`
ssh-add然而,我们如何在使用vscode时做到这一点呢?一种方法是使用命令行启动vscode,但这不是一个很好的解决方案。
我想知道在vscode或生锈分析器插件中是否有一些可以提供帮助的信息。
发布于 2022-10-23 12:58:18
我发现修改~/.cargo/config会有帮助。
[net]
git-fetch-with-cli = truehttps://stackoverflow.com/questions/74170084
复制相似问题