git - 如何让 git config ReplaceOf 与 Cargo 一起使用?

标签 git rust rust-cargo

我的 ~/.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/

相关文章:

rust - 如何删除使用 cargo install 安装的二进制文件?

rust - 包含库和二进制文件的包?

git - 具有 ssh 访问 bitbucket : Permission denied (publickey). fatal error 的 Jenkins git 插件:无法从远程存储库读取

Gitlab备份报错: pack-objects died of signal 9

git - 如何在 git 日志图中显示相对提交号?

Rust:在任务中执行解除引用的闭包

rust - 当我写入随机内存地址时会发生什么?

git push -u origin master 致命: unable to update url base from redirection:

rust - 如何解析 RFC2822 中的日期,允许在字符串末尾使用时区?

rust - 如何解决 Cargo 中的循环依赖?