Reputation: 11561
I have the following in my ~/.gitconfig:
[url "[email protected]:"]
pushInsteadOf = https://github.com/
insteadOf = https://github.com/
Unfortunately today I discovered that this prevents me from making cargo build
download dependencies for me:
Updating crates.io index
error: failed to get `libc` as a dependency of package `hilbert-c2rust v0.1.4 (/home/d33tah/workspace/profound/hilbert-c2rust)`
Caused by:
failed to load source for dependency `libc`
Caused by:
Unable to update registry `https://github.com/rust-lang/crates.io-index`
Caused by:
failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by:
failed to authenticate when downloading repository
attempted ssh-agent authentication, but none of the usernames `git` succeeded
Caused by:
no authentication available
Is there a workaround for this problem? Commenting out the lines temporarily helps, but I'd like to keep them because they solve a problem related to Github for me.
Upvotes: 8
Views: 6905
Reputation: 1678
cd ~/.cargo
touch config
edit config
with whatever you want i.e nvim config
and paste this
[net]
git-fetch-with-cli = true
Upvotes: 1
Reputation: 111
Try this (from here):
[url "ssh://[email protected]/"]
insteadOf = https://github.com
[url "https://github.com/rust-lang/crates.io-index"]
insteadOf = https://github.com/rust-lang/crates.io-index
Upvotes: 6
Reputation: 422
For some reason creating an ssh-agent
and adding your identities to the agent did it for me.
eval `ssh-agent -s`
ssh-add
cargo build
I believe this fix is particular to cargo because you can still pull and push to private repositories and yet the authentication will fail on cargo update.
Upvotes: 2
Reputation: 21
This also occurs when the user's git is configured with ssh and cargo is unable to find the key configured.
To solve this navigate to '.ssh' file and run ssh-add id_rsa
and then try again.
This is the only solution that worked for me after hours of head hunting.
Upvotes: 0