cargo: default username used for git clones over ssh is not generally correct
This might be a duplicate of #1851 or #2078 but I can’t quite tell. My understanding is that cargo is supposed to use ssh-agent for authentication, but I can’t get this to work.
I have a dependency with a git-over-ssh path:
[dependencies.sma_utils]
git = "ssh://gitsrvsim/usr/abaqus60/GITrepo/sma_rust.git"
SSH to this machine is password-less (due to ssh-agent, and not due a .ssh/config file):
$ ssh -o BatchMode=yes gitsrvsim hostname
Permission denied (publickey,gssapi-with-mic,password).
$ ssh-add ~/.ssh/sim_internal
Identity added: /u/users/lxd/.ssh/sim_internal (/u/users/lxd/.ssh/sim_internal)
$ ssh -o BatchMode=yes gitsrvsim hostname
gitsrvsim
But cargo build still fails:
cargo build --verbose
Updating registry `https://github.com/rust-lang/crates.io-index`
Updating git repository `ssh://gitsrvsim/usr/abaqus60/GITrepo/sma_rust.git`
Unable to update ssh://gitsrvsim/usr/abaqus60/GITrepo/sma_rust.git
Caused by:
failed to fetch into /rd/gen/lxd/do_not_delete/multirust/.cargo/git/db/sma_rust-0fec95efab468a0c
Caused by:
failed to authenticate when downloading repository
Caused by:
[7/-1] Config value 'credential.helper' was not found
My quick googling suggests that git’s credential-helper is primarily used for HTTPS authentication. No one seems to use it for ssh (likely because git can use ~/.ssh/config). My git is not new enough to have the credential-helper subsystem.
So I can’t really tell where the problem lies. Currently running `cargo 0.9.0-nightly (4739ba1 2016-02-16)
Thanks!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (19 by maintainers)
Commits related to this issue
- Auth with more usernames and improve errors This commit is an attempt to improve the error message from failed authentication attempts as well as attempting more usernames. Right now we only attempt ... — committed to alexcrichton/cargo by alexcrichton 8 years ago
- Auto merge of #2407 - alexcrichton:better-failed-auth-error, r=brson This commit is an attempt to improve the error message from failed authentication attempts as well as attempting more usernames. R... — committed to rust-lang/cargo by bors 8 years ago
- Correctly attempt multiple usernames with libgit2 This commit corrects the logic for attempting multiple usernames with libgit2. There is a restriction that for each authentication seession you can o... — committed to alexcrichton/cargo by alexcrichton 8 years ago
- Auto merge of #2584 - alexcrichton:auth-more, r=brson Correctly attempt multiple usernames with libgit2 This commit corrects the logic for attempting multiple usernames with libgit2. There is a rest... — committed to rust-lang/cargo by bors 8 years ago
- Auto merge of #11448 - Byron:integrate-gitoxide, r=weihanglo gitoxide integration: fetch This PR is the first step towards resolving #1171. In order to get there, we integrate `gitoxide` into `carg... — committed to rust-lang/cargo by bors a year ago
I too ran into this issue, using the
insteadOfconfiguration for git. I had used this so that I could rungo getfor private repos.@alexcrichton @eminence I also occurred.
but comment-out this lines on
~/.gitconfig, solved the problem. I’m usuallyinsteadOfurl. Maybe this setting popular. Ifcargocommand does not support for it, I think that there is a need.I hope this will help.
Ok, I’ve attempted a fix for this again at https://github.com/rust-lang/cargo/pull/2584, @eminence could you try that out?