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

url."[email protected]:".insteadOf "https://github.com/" in gitconfig breaks Cargo fetch mechanism #8959

Closed
XVilka opened this issue Dec 8, 2020 · 2 comments
Labels
C-bug Category: bug

Comments

@XVilka
Copy link

XVilka commented Dec 8, 2020

Problem
Building Go modules from private repositories requires URL substitution in git, but it has to be done globally, because local solution doesn't work, probably a git bug. Sadly, it breaks Cargo fetching mechanism with the following error:

18:41:34 
    Updating crates.io index
error: failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  failed to authenticate when downloading repository: [email protected]:rust-lang/crates.io-index

  * 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:
  error authenticating: no auth sock variable; class=Ssh (23)

While it can be workarounded by adding and removing this substitution rule every time you have to switch between Go and Rust development, it would be awesome to make cargo work in this scenario too.

Steps

[i] ℤ git config --global url."[email protected]:".insteadOf "https://github.com/" 
[i] ℤ cargo install mdbook                                                                                                                                                                                                        

Notes

Output of cargo version:

[i] ℤ cargo --version
cargo 1.48.0 (65cbdd2dc 2020-10-14)
[i] ℤ rustc --version                                                                                                                                                                                                             
rustc 1.48.0 (7eac88abb 2020-11-16)
[i] ℤ rustup --version                                                                                                                                                                                                            
rustup 1.23.1 (3df2264a9 2020-11-30)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.48.0 (7eac88abb 2020-11-16)`

Fedora 33 x86_64

@XVilka XVilka added the C-bug Category: bug label Dec 8, 2020
@alexcrichton
Copy link
Member

I think this is perhaps a dupe of #8172 or #2078

@ehuss
Copy link
Contributor

ehuss commented Jan 7, 2021

Yea, closing as a duplicate of #8172.

There's a workaround noted in #8172 (comment) about specifying a specific insteadOf for Cargo. Additionally, net.git-fetch-with-cli might be an option.

@ehuss ehuss closed this as completed Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants