我的 ~/.gitconfig 中有以下内容:
[url "git@github.com:"]
pushInsteadOf = https://github.com/
insteadOf = https://github.com/
不幸的是,今天我发现这使我无法制作 cargo build
为我下载依赖项: Updating crates.io index
error: failed to get `libc` as a dependency of package `hilbert-c2rust v0.1.4 (/home/d33tah/workspace/profound/hilbert-c2rust)`
Caused by:
failed to load source for dependency `libc`
Caused by:
Unable to update registry `https://github.com/rust-lang/crates.io-index`
Caused by:
failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
failed to authenticate when downloading repository
attempted ssh-agent authentication, but none of the usernames `git` succeeded
Caused by:
no authentication available
这个问题有解决方法吗?暂时注释掉这些行会有所帮助,但我想保留它们,因为它们为我解决了与 Github 相关的问题。
最佳答案
将环境变量 CARGO_NET_GIT_FETCH_WITH_CLI 设置为 true。
关于git - 如何让 git config ReplaceOf 与 Cargo 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62640383/