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

Most upvoted comments

I too ran into this issue, using the insteadOf configuration for git. I had used this so that I could run go get for private repos.

@alexcrichton @eminence I also occurred.

but comment-out this lines on ~/.gitconfig, solved the problem. I’m usually insteadOf url. Maybe this setting popular. If cargo command does not support for it, I think that there is a need.

I hope this will help.

[http]
    cookiefile = ~/.config/git/.gitcookies
    sslCAInfo = /usr/local/etc/ssl/certs/curl-ca-bundle.crt

# URL shorthands
[url "git@github.com:"]
    insteadOf = "https://github.com/"
    pushInsteadOf = "github:"
    pushInsteadOf = "git://github.com/"

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

[url "git@gist.github.com:"]
    insteadOf = "gst:"
    pushInsteadOf = "gist:"
    pushInsteadOf = "git://gist.github.com/"

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

Ok, I’ve attempted a fix for this again at https://github.com/rust-lang/cargo/pull/2584, @eminence could you try that out?