git/list[1] front-page[2] threads[3] people[4] search[5] about
 

transfer.credentialsInUrl should warn about personal access tokens in user field #leftoverbits

From
M Hickford <mirth.hickford@gmail.com>
Date
Jan 10, 2025, 21:05 UTC
Message-ID
<20250110210500.675629-1-mirth.hickford@gmail.com>
Assuming config key transfer.credentialsInUrl is set to "warn", Git warns about "plaintext credentials" if the user includes a password in the remote URL. https://git-scm.com/docs/git-config#Documentation/git-config.txt-transfercredentialsInUrl . This is implemented in remote.c
    $ git clone https://tim:hunter2@example.com/example.git
    warning: URL 'https://tim:<redacted>@example.com/example.git' uses plaintext credentials
It would be neat to warn similarly if the user includes a personal access token in the *user* field of the remote URL:
    git clone https://<pat>@github.com/...
This is a popular practice according to StackOverflow https://stackoverflow.com/a/70320541/284795 (800k views).
GitHub personal access tokens are easily recognised by their prefixes "ghp_" and "github_pat_" https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-authentication-to-github#githubs-token-formats 
#leftoverbits
Next: Junio C Hamano
Message 1 of 11 in “transfer.credentialsInUrl should warn about personal access tokens in user field #leftoverbits”
  1. M HickfordJan 10, 2025
  2. Junio C HamanoJan 10, 2025
  3. brian m. carlsonJan 10, 2025
  4. Junio C HamanoJan 10, 2025
  5. brian m. carlsonJan 11, 2025
  6. Junio C HamanoJan 11, 2025
  7. rsbecker@nexbridge.comJan 11, 2025
  8. M HickfordJan 18, 2025
  9. rsbecker@nexbridge.comJan 10, 2025
  10. Randall BeckerJan 10, 2025
  11. Junio C HamanoJan 10, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.