Skip to content

Commit 3e96f1a

Browse files
authored
docs: mention wrong URLs as a cause of git authentication errors (#15304)
I was seeing an error like the following in my `rust-analyzer` output. ``` error: failed to load source for dependency `fontdue` Caused by: Unable to update https://github.com/xiphseer/fontdue.git?rev=67b963af0d5ca9e09bfeb0b5a9adf85c302d0a67 Caused by: failed to fetch into: /home/daniel/.local/share/cargo/git/db/fontdue-4d0b06b88bb2e092 Caused by: revision 67b963af0d5ca9e09bfeb0b5a9adf85c302d0a67 not found Caused by: failed to authenticate when downloading repository * attempted to find username/password via git's `credential.helper` support, but failed if the git CLI succeeds then `net.git-fetch-with-cli` may help here https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli Caused by: failed to acquire username/password from local configuration ``` 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.
2 parents 6cf8267 + 82f4b1e commit 3e96f1a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/doc/src/appendix/git-authentication.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ handle fetching remote repositories instead of using the built-in support.
1010
This can be enabled with the `CARGO_NET_GIT_FETCH_WITH_CLI=true` environment
1111
variable.
1212

13+
> **Note:** Cargo does not require authentication for public git dependencies
14+
> so if you see an authentication failure in that context, ensure that the
15+
> URL is correct.
16+
1317
## HTTPS authentication
1418

1519
HTTPS authentication requires the [`credential.helper`] mechanism. There are

0 commit comments

Comments
 (0)