Skip to content

Cargo config flag not getting evaluated #13866

@PoisonPhang

Description

@PoisonPhang

Problem

When passing Cargo config values via the --config flag, they don't seem to be getting evaluated.

For example, running:

cargo --config net.git-fetch-with-cli=true clippy --all

while working on a private repository results in:

    Updating git repository `https://github.com/unionlabs/ethers-rs`
error: failed to get `ethers` as a dependency of package `unionlabs v0.1.0 (/home/poisonphang/projects/github/unionlabs/union/lib/unionlabs)`

Caused by:
  failed to load source for dependency `ethers`

Caused by:
  Unable to update https://github.com/unionlabs/ethers-rs?branch=ethers-core-wasm#fd10abba

Caused by:
  failed to fetch into: /home/poisonphang/.cargo/git/db/ethers-rs-efea9688c919e664

Caused by:
  failed to authenticate when downloading repository: ssh://git@github.com/unionlabs/ethers-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 methods succeeded

Steps

No response

Possible Solution(s)

For this specific instance, using environment variables (such as CARGO_NET_GIT_FETCH_WITH_CLI=true sufficed), but the --config flag was still not functioning.

Notes

Additionally, trying to provide invalid keys for the --config flag did not result in any errors.

Version

cargo 1.79.0-nightly (c93926759 2024-04-23)
release: 1.79.0-nightly
commit-hash: c9392675917adc2edab269eea27c222b5359c637
commit-date: 2024-04-23
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: NixOS 23.11.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions