-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Authentication failure with git dependencies via https on Windows (10) #5227
Comments
Thanks for the report! Can you share the global This is likely due to https://github.com/alexcrichton/git2-rs/issues/274 but I'd just want to confirm! |
My
Changing the helper to Now I tried adding the Git/bin to my UpdateI have restartet my machine and now cargo is downloading my dependency. So it seems to be necessary to add the Git/bin path to the |
Ok thanks @spaeger! The fact that updating Would you be willing to try out a custom build of Cargo to see what the issue is? I've just added some debug logging for failed credential helper invocations, testing that out should hopefully be as easy as cloning this repository, adding this to [patch.crates-io]
git2 = { git = 'https://github.com/alexcrichton/git2-rs' } and then |
Oh and getting the logging out would look like:
|
As I added to my comment above, it is now working after a restart. Maybe Powershell does not take it before a logout/login. So it was just an error on my side. |
oh oops, sorry I missed that! I'll look into removing the need to do that. |
Thank you for your fast help! 👍 |
Today I unfortunately found out, that adding the PATH does not seem to work on my other W10 machine. I can open a shell with I tried to compile Cargo with the following lines added at top of the [patch.crates-io]
git2 = { git = 'https://github.com/alexcrichton/git2-rs' } but it fails with: > cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
error: multiple packages link to native library `git2`, but a native library can be linked only once
package `libgit2-sys v0.7.1 (https://github.com/alexcrichton/git2-rs.git#0c1eb687)`
... which is depended on by `git2 v0.7.1 (https://github.com/alexcrichton/git2-rs.git#0c1eb687)`
... which is depended on by `git2-curl v0.8.1`
... which is depended on by `cargo v0.27.0 (file:///C:/****/cargo)`
links to native library `git2`
package `libgit2-sys v0.7.1`
... which is depended on by `cargo v0.27.0 (file:///C:/****/cargo)`
also links to native library `git2` Did I miss something? |
@spaeger what version of Cargo/Rustc were you testing with? |
I should be using the latest version: > cargo --version
cargo 0.26.0 (41480f5cc 2018-02-26)
> rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: checking for self-updates
stable-x86_64-pc-windows-msvc unchanged - rustc 1.25.0 (84203cac6 2018-03-25)
nightly-x86_64-pc-windows-msvc unchanged - rustc 1.26.0-nightly (06fa27d7c 2018-04-01) |
@spaeger can you try using nightly and see if that helps? |
@alexcrichton I just installed the latest nightly and tried building cargo (and downloading my git dependency). Both does still not work. But the error got a bit shorter: > cargo build
Updating git repository `https://github.com/alexcrichton/git2-rs`
Updating registry `https://github.com/rust-lang/crates.io-index`
error: multiple packages link to native library `git2`, but a native library can be linked only once
package `libgit2-sys v0.7.1`
... which is depended on by `cargo v0.27.0 (file:///C:/****/cargo)`
links to native library `git2`
package `libgit2-sys v0.7.1 (https://github.com/alexcrichton/git2-rs#0c1eb687)`
... which is depended on by `git2 v0.7.1 (https://github.com/alexcrichton/git2-rs#0c1eb687)`
... which is depended on by `cargo v0.27.0 (file:///C:/****/cargo)`
also links to native library `git2` This is my `Cargo.toml` of the cargo crate, maybe I misunderstood something: [Expand][patch.crates-io]
git2 = { git = 'https://github.com/alexcrichton/git2-rs' }
[package]
name = "cargo"
version = "0.27.0"
authors = ["Yehuda Katz <[email protected]>",
"Carl Lerche <[email protected]>",
"Alex Crichton <[email protected]>"]
license = "MIT OR Apache-2.0"
homepage = "https://crates.io"
repository = "https://github.com/rust-lang/cargo"
documentation = "https://docs.rs/cargo"
description = """
Cargo, a package manager for Rust.
"""
[lib]
name = "cargo"
path = "src/cargo/lib.rs"
[dependencies]
atty = "0.2"
crates-io = { path = "src/crates-io", version = "0.16" }
crossbeam = "0.3"
crypto-hash = "0.3"
curl = "0.4.6"
env_logger = "0.5"
failure = "0.1.1"
filetime = "0.1"
flate2 = "1.0"
fs2 = "0.4"
git2 = "0.7.0"
git2-curl = "0.8"
glob = "0.2"
hex = "0.3"
home = "0.3"
ignore = "0.4"
lazy_static = "1.0.0"
jobserver = "0.1.9"
lazycell = "0.6"
libc = "0.2"
libgit2-sys = "0.7"
log = "0.4"
num_cpus = "1.0"
same-file = "1"
semver = { version = "0.9.0", features = ["serde"] }
serde = "1.0"
serde_derive = "1.0"
serde_ignored = "0.0.4"
serde_json = "1.0"
shell-escape = "0.1"
tar = { version = "0.4", default-features = false }
tempfile = "3.0"
termcolor = "0.3"
toml = "0.4"
url = "1.1"
clap = "2.31.2"
# Not actually needed right now but required to make sure that rls/cargo build
# with the same set of features in rust-lang/rust
num-traits = "0.2" # enable the default feature
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = { version = "0.5.1", features = ["mac_os_10_7_support"] }
[target.'cfg(windows)'.dependencies]
miow = "0.3"
[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
features = [
"handleapi",
"jobapi",
"jobapi2",
"minwindef",
"ntdef",
"ntstatus",
"processenv",
"processthreadsapi",
"psapi",
"synchapi",
"winerror",
"winbase",
"wincon",
"winnt",
]
[dev-dependencies]
bufstream = "0.1"
[[bin]]
name = "cargo"
test = false
doc = false
|
Okay, thanks to someones help, loading the git dependency works now.
The first step should not be necessary, if one has already installed the manager with the git installation, since on my other machine it is working without the additional installation. The third step should also not be necessary, since it was working without this on my other machine and I could remove the setting SummaryTo make git dependencies with https authentication working, this steps should be sufficient:
Should I close the issue or would you prefer to let it opened until this is implemented inside cargo? |
@spaeger ok I'm glad you got it working! With nightly though I was curious about whether nightly works for your project, not for building Cargo itself. Does nightly require the extra steps you mentioned shouldn't be neessary? |
Loading the git dependency now seems to work on both of my machines with both nightly and stable.
is set. On both the |
Ok good to confirm! I think this was fixed in alexcrichton/git2-rs@256f12b which should be in nightly Cargo, so I'm going to close this in that case. |
I'm on the latest nightly, nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.27.0-nightly (eeea94c11 2018-04-06) This is a fairly 'fresh' install of Ubuntu and cargo. Ubuntu 16.04.3.
|
@insanitybit do you have git's credential helper support configured and has your password previously been cached? |
Er, actually, I probably don't have it configured since the system is new. But I pulled down other deps just fine:
This works, for example. I'm unfamiliar with the credential helper/ configuration stuff - if this is on my end I'll happily go sort that out. |
If you're cloning a public repo you probably don't need authentication and the way github is set up if you're asked for authentication it may mean that a typo was made? |
I just ran into this problem as well. Each of the following failed
What did work was this
I undid the other changes before I tried the last one, so that seems to be all that's needed. So it looks like git in this case is not picking up the system config settings |
Summary
Cargo fails to load a git dependency over https on Windows because of not finding the credentials via git's credentials-helper. The credentials are saved in Windows Credentials Manager and a normal git clone works perfectly fine without entering credentials. The problem is not present on Linux using credentials-cache.
What we have tried
pfwr = { git = "https://git.****.****/****/pfwr.git" }
What we expected
What happened instead
Cargo version
cargo --version
on my W10 machine is:cargo 0.25.0 (96d8071da 2018-02-26)
The text was updated successfully, but these errors were encountered: