我正在尝试设置货物以使用 Artifactory 代理到 crates.io 注册表。 我公司的Artifactory团队根据JFrog的官方文档
为我设置了它Config.toml
,我使用他们提供的确切配置创建它,但似乎没有任何效果,我无法通过 Cargo 安装任何东西。
这就是我得到的:
Updating `artifactory` index
fatal: protocol error: bad pack header
error: failed to fetch `https://<AF_URL>/artifactory/git/crates-io-cargo-proxy.git`
Caused by:
process didn't exit successfully: `git fetch --force --update-head-ok 'https://artifacts.rbi.tech/artifactory/git/crates-io-cargo-proxy.git' '+HEAD:refs/remotes/origin/HEAD'` (exit status: 128)
如果我关掉
git-fetch-with-cli
,我会得到这个:
Updating `artifactory` index
warning: spurious network error (2 tries remaining): early EOF; class=Net (12); code=Eof (-20)
warning: spurious network error (1 tries remaining): early EOF; class=Net (12); code=Eof (-20)
error: failed to fetch `https://<AF_URL>/artifactory/git/crates-io-cargo-proxy.git`
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:
early EOF; class=Net (12); code=Eof (-20)
我尝试使用
Config.toml
中的许多不同选项以及环境变量,但我无法使其工作。
有没有人有这方面的经验?
我自己也遇到过类似的情况,错误消息似乎与解决方案无关。
这可能取决于所使用的 Artifactory 版本,但默认情况下,当创建远程存储库时,货物设置下的存储库 url 和注册表 url 设置为
https://github.com/rust-lang/crates.io-index
我将这两个更改为
https://index.crates.io/
并检查了
Enable sparse index support
。然后我补充了
[source.artifactory]
registry = "sparse+https://<ARTIFACTORY_URL>/artifactory/api/cargo/<REPO_NAME>/index/"
[source.crates-io]
replace-with = "artifactory"
到我的
~/.cargo/config.toml
文件,但没有包括
[net]
git-fetch-with-cli = true