Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo update dependencies failed case by execute git command failed #14152

Closed
Gitfz810 opened this issue Jun 26, 2024 · 2 comments
Closed

Cargo update dependencies failed case by execute git command failed #14152

Gitfz810 opened this issue Jun 26, 2024 · 2 comments
Labels
A-git Area: anything dealing with git C-bug Category: bug Command-add S-propose-close Status: A team member has nominated this for closing, pending further input from the team

Comments

@Gitfz810
Copy link

Gitfz810 commented Jun 26, 2024

Problem

Description

Cargo add personal repo failed.

image

It seems that cargo use git command only read the global configuration.

Steps

  1. cargo new foo && cd foo
  2. git config url."ssh://git@<personal git address>".insteadOf "https://<personal git address>"
  3. mkdir .cargo
cat > .cargo/config.toml << EOF
[net]
git-fetch-with-cli = true
EOF
  1. cargo add <repo name> --git <https://<personal git address>/<repo name>.git

Possible Solution(s)

I don't know how to fix it, but for now I add git global configuration to fix it.
git config --global url."ssh://git@<personal git address>".insteadOf "https://<personal git address>"

Notes

No response

Version

$ cargo version --verbose
cargo 1.78.0 (54d8815d0 2024-03-26)
release: 1.78.0
commit-hash: 54d8815d04fa3816edc207bbc4dd36bf18014dbc
commit-date: 2024-03-26
host: aarch64-apple-darwin
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 7.86.0 (sys:0.4.72+curl-8.6.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 13.2.0 [64-bit]
@Gitfz810 Gitfz810 added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jun 26, 2024
@epage epage added Command-add A-git Area: anything dealing with git S-needs-team-input Status: Needs input from team on whether/how to proceed. and removed S-triage Status: This issue is waiting on initial triage. labels Jun 26, 2024
@weihanglo
Copy link
Member

It seems that cargo use git command only read the global configuration.

That is kinda expected. One can argue that git CLI invocation should respect project local configurations. However, git dependencies cache in Cargo is global. Respecting local configurations may pollute the global cache with unexpected data or format, leading the cache to be in an unusable state.

Here is the code that spawning git is spawn at the directory of the repository-to-fetch.

Therefore, I propose to the team to close this.

@rustbot label +S-propose-to-close -S-needs-team-input

@weihanglo weihanglo added S-propose-close Status: A team member has nominated this for closing, pending further input from the team and removed S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Jul 11, 2024
@epage
Copy link
Contributor

epage commented Jul 12, 2024

I second this.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-bug Category: bug Command-add S-propose-close Status: A team member has nominated this for closing, pending further input from the team
Projects
None yet
Development

No branches or pull requests

3 participants