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

[PATCH v2 2/2] docs: discuss caching personal access tokens

From
M Hickford via GitGitGadget <gitgitgadget@gmail.com>
Date
Jan 10, 2025, 22:54 UTC
Message-ID
<ac8c5e1b55289d6a0acc621d1b63fb57822af595.1736549677.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1851.v2.git.1736549677.gitgitgadget@gmail.com>
From: M Hickford <mirth.hickford@gmail.com>

Describe problems storing personal access tokens in git-credential-cache and suggest alternatives.

Research suggests that many users are confused about this:
> the point of passwords is that (ideally) you memorise them [so]
> they're never stored anywhere in plain text. Yet GitHub's personal
> access token system seems to basically force you to store the token in
> plain text?
https://stackoverflow.com/questions/46645843/where-to-store-my-git-personal-access-token#comment89963004_46645843
Signed-off-by: M Hickford <mirth.hickford@gmail.com>
---
 Documentation/git-credential-cache.txt | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/Documentation/git-credential-cache.txt b/Documentation/git-credential-cache.txt
index 487cc557a87..54fa7a27e19 100644
--- a/Documentation/git-credential-cache.txt
+++ b/Documentation/git-credential-cache.txt
@@ -78,6 +78,23 @@ variable (this example increases the cache time to 1 hour):
 $ git config credential.helper 'cache --timeout=3600'
 -------------------------------------------------------
 
+PERSONAL ACCESS TOKENS
+----------------------
+
+Some remotes accept personal access tokens, which are randomly
+generated and hard to memorise. They typically have a lifetime of weeks
+or months.
+
+git-credential-cache is inherently unsuitable for persistent storage of
+personal access tokens. The credential will be forgotten after the cache
+timeout. Even if you configure a long timeout, credentials will be
+forgotten if the daemon dies.
+
+To avoid frequently regenerating personal access tokens, configure a
+credential helper with persistent storage. Alternatively, configure an
+OAuth credential helper to generate credentials automatically. See
+linkgit:gitcredentials[7], sections "Available helpers" and "OAuth".
+
 GIT
 ---
 Part of the linkgit:git[1] suite
-- 
gitgitgadget
Previous: M Hickford via GitGitGadget
Message 7 of 7 in “docs: discuss caching personal access tokens”
  1. docs: discuss caching personal access tokensM Hickford via GitGitGadget, Jan 9, 2025
  2. Junio C HamanoJan 10, 2025
  3. rsbecker@nexbridge.comJan 10, 2025
  4. M HickfordJan 10, 2025
  5. 0/2 docs: discuss caching personal access tokensM Hickford via GitGitGadget, Jan 10, 2025
  6. 1/2 docs: list popular credential helpersM Hickford via GitGitGadget, Jan 10, 2025
  7. 2/2 docs: discuss caching personal access tokensM Hickford via GitGitGadget, Jan 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.