nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

Cargo index update stopped working with url rewrite #100

Closed mriehl closed 5 years ago

mriehl commented 5 years ago

Hi,

cargo install-update stopped working for me:

cargo install-update -a
    Updating registry 'https://github.com/rust-lang/crates.io-index'
Failed to update index repository: authentication required but no callback set.

Cargo itself is still able to update the crates index.

I managed to track down the culprit, in my .gitconfig I have:

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

I think I added this because of golang's go get that hardcodes https urls, while I use almost only ssh agent git remoting. Anyway this rewrites the https crates repository to ssh, which then requires a callback challenge (ssh agent), which isn't set by cargo-update.

Cargo itself is able to deal with this because they add the git2 callbacks for remote authentication (ssh agent in this case). Would you consider adding callbacks too, so that it "just works" over ssh too? I can try to hack something together.

For reference this is cargo's credential callback

nabijaczleweli commented 5 years ago

Hey, sorry for the delay on this, but I was in absolutely no state to even read this (not that I fully get it now, when words actually seem to have meaning :v)

So, like, that piece of .gitconfig silently rewrites all URLs to use SSH, and using SSH requires some additional "challenge" callback which we don't set and therefore fuck up on?

If you could slap something together, that'd be lovely, yes 💜

nabijaczleweli commented 5 years ago

@mriehl can you check current master with the commit above?

nabijaczleweli commented 5 years ago

Released in v1.8.0, but I'm all ears for how well this behaves!

mriehl commented 5 years ago

Can confirm that it works. Thanks a lot!!