docs: mention wrong URLs as a cause of git authentication errors#15304
docs: mention wrong URLs as a cause of git authentication errors#15304weihanglo merged 1 commit intorust-lang:masterfrom
Conversation
| > **Note:** Cargo does not require authentication for public git dependencies | ||
| > so if you see an authentication failure in that context, ensure that the | ||
| > URL is correct. |
There was a problem hiding this comment.
Thanks for the pull request!
I think the problem is more like libgit2 doesn't provide a prompt and ask for credentials. Cargo may still require credentials if a Git repo is specified with SSH protocol. The sentences here are great but a bit imprecise. Not sure how to rephrase it. Maybe something like this?
| > **Note:** Cargo does not require authentication for public git dependencies | |
| > so if you see an authentication failure in that context, ensure that the | |
| > URL is correct. | |
| > **Note:** Cargo does not provide a prompt for Git authentication. | |
| > If you see an authentication failure, first ensure that the URL is correct. |
There was a problem hiding this comment.
Hmm, I feel like that leaves out the specific case I was thinking about, which is an intentionally public repo not needing authentication and thus not benefiting from a prompt. I usually use SSH, but intentionally put a git = 'https://github.com/xiphoseer/fontdue.git' URL there for it to work in CI without extra steps.
There was a problem hiding this comment.
I think yeah my suggestion did lose the most important point of your patch. This note doesn't need to be 100% perfect reflecting every technical detail.
Thanks for the help. Going to merge this now!
Update cargo 14 commits in 6cf8267012570f63d6b86e85a2ae5627de52df9e..307cbfda3119f06600e43cd38283f4a746fe1f8b 2025-03-14 15:25:36 +0000 to 2025-03-20 20:00:39 +0000 - feat: Add custom completer for cargo <TAB> to complete aliases defined in config.toml (rust-lang/cargo#15319) - fix(build-dir): Renamed workspace-manifest-path-hash to workspace-path-hash (rust-lang/cargo#15334) - feat: vcs, color, and message format native completion (rust-lang/cargo#15322) - Fix `[env]` `relative` description in reference (rust-lang/cargo#15332) - chore: fix some typos (rust-lang/cargo#15329) - Cleanup for rustc-link-arg-cdylib (rust-lang/cargo#15326) - fix(toml): Report '<target>.edition' deprecation to users (rust-lang/cargo#15321) - test(build-std): address overly-matched snapshot (rust-lang/cargo#15325) - Added `build.build_dir` templating support (rust-lang/cargo#15236) - docs: make it clearer that `rust_version` is enforced during compile (rust-lang/cargo#15303) - feat: Add custom completer for cargo +<TAB> to complete toolchain name (rust-lang/cargo#15301) - chore: fix some typos (rust-lang/cargo#15316) - fix: deduplicate crate types in cargo rustc command (rust-lang/cargo#15314) - docs: mention wrong URLs as a cause of git authentication errors (rust-lang/cargo#15304) r? ghost
I was seeing an error like the following in my
rust-analyzeroutput.I spent about 10 minutes reading the docs on git authentication, before realizing I had just typo'ed my own GitHub username. This PR adds a note to the reference that explicitly mentions wrong (not malformed) URLs as a cause of authentication errors.
It's not directly on the linked https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli mainly because Git Authentication is already linked there, so it may catch more people and that's meant as the more detailed explanation anyway.