Skip to content

Commit 6ecb4fc

Browse files
committed
Merge branch 'mh/doc-credential-helpers-with-pat'
Document that it is insecure to use Personal Access Tokens, which some hosting providers take as username/password, embedded in URLs. * mh/doc-credential-helpers-with-pat: docs: discuss caching personal access tokens docs: list popular credential helpers
2 parents 294673a + a90ff40 commit 6ecb4fc

File tree

2 files changed

+46
-12
lines changed

2 files changed

+46
-12
lines changed

Documentation/git-credential-cache.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ variable (this example increases the cache time to 1 hour):
7878
$ git config credential.helper 'cache --timeout=3600'
7979
-------------------------------------------------------
8080

81+
PERSONAL ACCESS TOKENS
82+
----------------------
83+
84+
Some remotes accept personal access tokens, which are randomly
85+
generated and hard to memorise. They typically have a lifetime of weeks
86+
or months.
87+
88+
git-credential-cache is inherently unsuitable for persistent storage of
89+
personal access tokens. The credential will be forgotten after the cache
90+
timeout. Even if you configure a long timeout, credentials will be
91+
forgotten if the daemon dies.
92+
93+
To avoid frequently regenerating personal access tokens, configure a
94+
credential helper with persistent storage. Alternatively, configure an
95+
OAuth credential helper to generate credentials automatically. See
96+
linkgit:gitcredentials[7], sections "Available helpers" and "OAuth".
97+
8198
GIT
8299
---
83100
Part of the linkgit:git[1] suite

Documentation/gitcredentials.txt

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,7 @@ storage provided by the OS or other programs. Alternatively, a
6666
credential-generating helper might generate credentials for certain servers via
6767
some API.
6868

69-
To use a helper, you must first select one to use. Git currently
70-
includes the following helpers:
71-
72-
cache::
73-
74-
Cache credentials in memory for a short period of time. See
75-
linkgit:git-credential-cache[1] for details.
76-
77-
store::
78-
79-
Store credentials indefinitely on disk. See
80-
linkgit:git-credential-store[1] for details.
69+
To use a helper, you must first select one to use (see below for a list).
8170

8271
You may also have third-party helpers installed; search for
8372
`credential-*` in the output of `git help -a`, and consult the
@@ -106,6 +95,28 @@ $ git config --global credential.helper foo
10695

10796
=== Available helpers
10897

98+
Git currently includes the following helpers:
99+
100+
cache::
101+
102+
Cache credentials in memory for a short period of time. See
103+
linkgit:git-credential-cache[1] for details.
104+
105+
store::
106+
107+
Store credentials indefinitely on disk. See
108+
linkgit:git-credential-store[1] for details.
109+
110+
Popular helpers with secure persistent storage include:
111+
112+
- git-credential-libsecret (Linux)
113+
114+
- git-credential-osxkeychain (macOS)
115+
116+
- git-credential-wincred (Windows)
117+
118+
- https://github.com/git-ecosystem/git-credential-manager[Git Credential Manager] (cross platform, included in Git for Windows)
119+
109120
The community maintains a comprehensive list of Git credential helpers at
110121
https://git-scm.com/doc/credential-helpers.
111122

@@ -116,6 +127,12 @@ OAuth credential helper. Initial authentication opens a browser window to the
116127
host. Subsequent authentication happens in the background. Many popular Git
117128
hosts support OAuth.
118129

130+
Popular helpers with OAuth support include:
131+
132+
- https://github.com/git-ecosystem/git-credential-manager[Git Credential Manager] (cross platform, included in Git for Windows)
133+
134+
- https://github.com/hickford/git-credential-oauth[git-credential-oauth] (cross platform, included in many Linux distributions)
135+
119136
CREDENTIAL CONTEXTS
120137
-------------------
121138

0 commit comments

Comments
 (0)