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

SSH support #333

Closed
msfjarvis opened this issue Sep 8, 2019 · 5 comments · Fixed by #334
Closed

SSH support #333

msfjarvis opened this issue Sep 8, 2019 · 5 comments · Fixed by #334

Comments

@msfjarvis
Copy link

I use the following snippet in my ~/.gitconfig file to force all GitHub connections to use authenticated SSH.

[url "[email protected]:"]
    insteadOf = https://github.com/
    insteadOf = git://github.com/

This causes cargo-edit to break in the following fashion.

$ cargo add clap
    Updating 'https://github.com/rust-lang/crates.io-index' index
Command failed due to unhandled error: authentication required but no callback set; class=Ssh (23)

This particular problem does not affect cargo itself, but I presume that is related to its usage or crates.io directly. Is there a way to resolve my particular use-case in this crate or I should I continue commenting out my force-ssh-for-github snippet everytime I use cargo-edit?

@ordian
Copy link
Collaborator

ordian commented Sep 8, 2019

hey @msfjarvis, thanks for opening the issue, can you confirm #334 fixes the issue?

@msfjarvis
Copy link
Author

hey @msfjarvis, thanks for opening the issue, can you confirm #334 fixes the issue?

It does!

bors bot added a commit that referenced this issue Oct 9, 2019
334: [fetch] use cli git for fetching crates.io index r=ordian a=ordian

Fixes #333.
Cargo has a fair amount of code for git authentication handling ([link](https://github.com/rust-lang/cargo/blob/57986eac7157261c33f0123bade7ccd20f15200f/src/cargo/sources/git/utils.rs#L410-L624)), but still has a cli fallback ([link](https://github.com/rust-lang/cargo/blob/57986eac7157261c33f0123bade7ccd20f15200f/src/cargo/sources/git/utils.rs#L704-L714)).
See rust-lang/cargo#2078 for details on all the arguments passed to git.

Co-authored-by: Andronik Ordian <[email protected]>
bors bot added a commit that referenced this issue Oct 9, 2019
334: [fetch] use cli git for fetching crates.io index r=ordian a=ordian

Fixes #333.
Cargo has a fair amount of code for git authentication handling ([link](https://github.com/rust-lang/cargo/blob/57986eac7157261c33f0123bade7ccd20f15200f/src/cargo/sources/git/utils.rs#L410-L624)), but still has a cli fallback ([link](https://github.com/rust-lang/cargo/blob/57986eac7157261c33f0123bade7ccd20f15200f/src/cargo/sources/git/utils.rs#L704-L714)).
See rust-lang/cargo#2078 for details on all the arguments passed to git.

Co-authored-by: Andronik Ordian <[email protected]>
@bors bors bot closed this as completed in e8d8eeb Oct 9, 2019
@farzadmf
Copy link

farzadmf commented Jan 26, 2022

Hi, I'm not by any means a Rust expert, and I'm getting the same error

cargo add structopt
    Updating 'https://github.com/rust-lang/crates.io-index' index
Command failed due to unhandled error: authentication required but no callback set; class=Ssh (23); code=Auth (-16)

I tried to create $CARGO_HOME/config.toml with this content:

[net]
git-fetch-with-cli = true   # use the `git` executable for git operations

but doesn't seem to be working. Can you please help?

I do have the following in my gitconfig:

[url "[email protected]:"]
  insteadOf = https://github.com/

And commenting that out makes cargo add successful, however, from the issue, I thought that we can have that in the config and everything would work

@ordian
Copy link
Collaborator

ordian commented Jan 27, 2022

Hello @farzadmf, see #515. We've switch to an external library which doesn't provide an API for fetching with git cli at the moment. So the issue was reintroduced.

@farzadmf
Copy link

Ah OK @ordian , thank you for the reply, I'll follow that issue then to see the progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants