<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/gitcredentials.txt, branch v2.48.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.48.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.48.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-11-25T05:20:15Z</updated>
<entry>
<title>doc: option value may be separate for valid reasons</title>
<updated>2024-11-25T05:20:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-11-25T03:14:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1bc1e940918cd44cc78bff1dfd518e16fc5bad57'/>
<id>urn:sha1:1bc1e940918cd44cc78bff1dfd518e16fc5bad57</id>
<content type='text'>
Even though `git help cli` recommends users to prefer using
"--option=value" over "--option value", there can be reasons why
giving them separately is a good idea.  One reason is that shells do
not perform tilde expansion for `--option=~/path/name` but they
expand `--options ~/path/name` just fine.

This is not a problem for many options whose option parsing is
properly written using OPT_FILENAME(), because the value given to
OPT_FILENAME() is tilde-expanded internally by us, but some commands
take a pathname as a mere string, which needs this trick to have the
shell help us.

I think the reason we originally decided to recommend the stuck form
was because an option that takes an optional value requires you to
use it in the stuck form, and it is one less thing for users to
worry about if they get into the habit to always use the stuck form.
But we should be discouraging ourselves from adding an option with
an optional value in the first place, and we might want to weaken
the current recommendation.

In any case, let's describe this one case where it is necessary to
use the separate form, with an example.

Reviewed-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mh/doc-credential-helpers'</title>
<updated>2023-07-18T14:28:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-07-18T14:28:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d6e67222c103783616912c26c9906b8167c39ab8'/>
<id>urn:sha1:d6e67222c103783616912c26c9906b8167c39ab8</id>
<content type='text'>
Doc update.

* mh/doc-credential-helpers:
  doc: gitcredentials: link to helper list
</content>
</entry>
<entry>
<title>doc: gitcredentials: link to helper list</title>
<updated>2023-07-10T17:35:55Z</updated>
<author>
<name>M Hickford</name>
<email>mirth.hickford@gmail.com</email>
</author>
<published>2023-07-08T20:36:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4c9cb51fe7beafc1033ec33e7f9d431c04d8b278'/>
<id>urn:sha1:4c9cb51fe7beafc1033ec33e7f9d431c04d8b278</id>
<content type='text'>
Link to community list of credential helpers. This is useful information
for users.

Describe how OAuth credential helpers work. OAuth is a user-friendly
alternative to personal access tokens and SSH keys. Reduced setup cost
makes it easier for users to contribute to projects across multiple
forges.

Signed-off-by: M Hickford &lt;mirth.hickford@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>credential: erase all matching credentials</title>
<updated>2023-06-15T20:26:41Z</updated>
<author>
<name>M Hickford</name>
<email>mirth.hickford@gmail.com</email>
</author>
<published>2023-06-15T19:19:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6c26da8404c8acfed62fa4775b7b591f099bcd33'/>
<id>urn:sha1:6c26da8404c8acfed62fa4775b7b591f099bcd33</id>
<content type='text'>
`credential reject` sends the erase action to each helper, but the
exact behaviour of erase isn't specified in documentation or tests.
Some helpers (such as credential-store and credential-libsecret) delete
all matching credentials, others (such as credential-cache) delete at
most one matching credential.

Test that helpers erase all matching credentials. This behaviour is
easiest to reason about. Users expect that `echo
"url=https://example.com" | git credential reject` or `echo
"url=https://example.com\nusername=tim" | git credential reject` erase
all matching credentials.

Fix credential-cache.

Signed-off-by: M Hickford &lt;mirth.hickford@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>credential: new attribute password_expiry_utc</title>
<updated>2023-02-22T23:18:58Z</updated>
<author>
<name>M Hickford</name>
<email>mirth.hickford@gmail.com</email>
</author>
<published>2023-02-18T06:32:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d208bfdfef97a1e8fb746763b5057e0ad91e283b'/>
<id>urn:sha1:d208bfdfef97a1e8fb746763b5057e0ad91e283b</id>
<content type='text'>
Some passwords have an expiry date known at generation. This may be
years away for a personal access token or hours for an OAuth access
token.

When multiple credential helpers are configured, `credential fill` tries
each helper in turn until it has a username and password, returning
early. If Git authentication succeeds, `credential approve`
stores the successful credential in all helpers. If authentication
fails, `credential reject` erases matching credentials in all helpers.
Helpers implement corresponding operations: get, store, erase.

The credential protocol has no expiry attribute, so helpers cannot
store expiry information. Even if a helper returned an improvised
expiry attribute, git credential discards unrecognised attributes
between operations and between helpers.

This is a particular issue when a storage helper and a
credential-generating helper are configured together:

	[credential]
		helper = storage  # eg. cache or osxkeychain
		helper = generate  # eg. oauth

`credential approve` stores the generated credential in both helpers
without expiry information. Later `credential fill` may return an
expired credential from storage. There is no workaround, no matter how
clever the second helper. The user sees authentication fail (a retry
will succeed).

Introduce a password expiry attribute. In `credential fill`, ignore
expired passwords and continue to query subsequent helpers.

In the example above, `credential fill` ignores the expired password
and a fresh credential is generated. If authentication succeeds,
`credential approve` replaces the expired password in storage.
If authentication fails, the expired credential is erased by
`credential reject`. It is unnecessary but harmless for storage
helpers to self prune expired credentials.

Add support for the new attribute to credential-cache.
Eventually, I hope to see support in other popular storage helpers.

Example usage in a credential-generating helper
https://github.com/hickford/git-credential-oauth/pull/16

Signed-off-by: M Hickford &lt;mirth.hickford@gmail.com&gt;
Reviewed-by: Calvin Wan &lt;calvinwan@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mh/gitcredentials-generate'</title>
<updated>2022-11-23T02:22:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-11-23T02:22:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c197977cb6b250906dbe1a05f899c65bb1ac2a9f'/>
<id>urn:sha1:c197977cb6b250906dbe1a05f899c65bb1ac2a9f</id>
<content type='text'>
Doc update.

* mh/gitcredentials-generate:
  Docs: describe how a credential-generating helper works
</content>
</entry>
<entry>
<title>Merge branch 'mh/credential-unrecognized-attrs'</title>
<updated>2022-11-18T23:43:59Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2022-11-18T23:43:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=35a62bb5798092d491e6c7e688db6cb1418c9098'/>
<id>urn:sha1:35a62bb5798092d491e6c7e688db6cb1418c9098</id>
<content type='text'>
Docfix.

* mh/credential-unrecognized-attrs:
  docs: clarify that credential discards unrecognised attributes
</content>
</entry>
<entry>
<title>Docs: describe how a credential-generating helper works</title>
<updated>2022-11-14T23:18:59Z</updated>
<author>
<name>M Hickford</name>
<email>mirth.hickford@gmail.com</email>
</author>
<published>2022-11-12T01:44:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dabb9d875f665ec5da9ae8c84fed765cf9187463'/>
<id>urn:sha1:dabb9d875f665ec5da9ae8c84fed765cf9187463</id>
<content type='text'>
Previously the docs only described storage helpers.

A concrete example: Git Credential Manager can generate credentials
for GitHub and GitLab via OAuth.
https://github.com/GitCredentialManager/git-credential-manager

Signed-off-by: M Hickford &lt;mirth.hickford@gmail.com&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
</content>
</entry>
<entry>
<title>docs: clarify that credential discards unrecognised attributes</title>
<updated>2022-11-13T04:57:34Z</updated>
<author>
<name>M Hickford</name>
<email>mirth.hickford@gmail.com</email>
</author>
<published>2022-10-24T07:57:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7fd54b6238e5802147a5ca259c3b5e6b8e06471d'/>
<id>urn:sha1:7fd54b6238e5802147a5ca259c3b5e6b8e06471d</id>
<content type='text'>
It was previously unclear how unrecognised attributes are handled.

Signed-off-by: M Hickford &lt;mirth.hickford@gmail.com&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
</content>
</entry>
<entry>
<title>Documentation/gitcredentials.txt: mention password alternatives</title>
<updated>2022-11-08T21:46:54Z</updated>
<author>
<name>M Hickford</name>
<email>mirth.hickford@gmail.com</email>
</author>
<published>2022-11-08T13:01:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=54e95b466334e8f6ba4421991cfc189e1291ea87'/>
<id>urn:sha1:54e95b466334e8f6ba4421991cfc189e1291ea87</id>
<content type='text'>
Git asks for a "password", but the user might use a
personal access token or OAuth access token instead.

Example:

    Password for 'https://AzureDiamond@github.com':

Signed-off-by: M Hickford &lt;mirth.hickford@gmail.com&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
</content>
</entry>
</feed>
