Confusing error message when using GitHub's SSH URL #13549
Description
Problem
It is fairly common for a Rust user to assume that the URL you get from GitHub to clone a repository (e.g. git@github.com:rust-lang/cargo.git
for Cargo) should be a valid value for the git
field in a dependency or when doing cargo install --git <URL>
.
It isn't, and that's OK.
But we also don't nudge the user in the right direction.
The first error they get is:
error: invalid url `<URL>`: relative URL without a base
If they figure out they need to add ssh://
in front, the error becomes:
error: invalid url `ssh://git@github.com:{org_name}/{repo_name}.git`: invalid port number
because the org name is interpreted as a port number (which isn't obvious from the error message, since it doesn't say what is being picked up as port number).
Steps
No response
Possible Solution(s)
I'd love to see better diagnostics from cargo
on this.
If the format of the URL matches what GitHub provides, we should be able to suggest the correct value (i.e. from git@github.com:{org_name}/{repo_name}.git
to ssh://git@github.com/{org_name}/{repo_name}.git
).
Notes
No response
Version
No response
Activity