git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Jan Tosovsky <j.tosovsky@email.cz>
Cc: git@vger.kernel.org
Subject: Re: Preserving credentials on authentication failures
Date: Wed, 21 Sep 2022 21:13:16 +0000	[thread overview]
Message-ID: <Yyt+bAllVYJ9+SXa@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <007401d8ccc6$ef8ebe50$ceac3af0$@email.cz>

[-- Attachment #1: Type: text/plain, Size: 1290 bytes --]

On 2022-09-20 at 07:59:38, Jan Tosovsky wrote:
> On my local Windows machine I maintain a credential store in the form of a
> text file. But from time to time one of the entries disappears. I run
> regularly some background jobs, cloning some stuff, and I suspect this
> happens when the external authentication service is down temporarily. When
> it is later resumed, I can't clone the repo anymore because of that deleted
> entry.
> 
> Is there any option to keep entries on authentication failures? Or is this
> simply a bug? Or is there another reason why this happens?

If you have a credential helper and the credentials retrieved from it
cause the server to send a 401, then Git will erase the credentials and
ask for new ones.  If your auth service is down, then the best thing for
your Git server to do is return a 503 if service cannot be maintained.
If it returns a 401 (which is not correct according to the RFC), then
Git will clear the credentials.

Git doesn't provide an option to preserve entries on authentication
failure, but you could write a simple shell script that wraps your
normal credential helper and ignores the "erase" command and use that
instead in `credential.helper`.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

      reply	other threads:[~2022-09-21 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  7:59 Preserving credentials on authentication failures Jan Tosovsky
2022-09-21 21:13 ` brian m. carlson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yyt+bAllVYJ9+SXa@tapette.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=j.tosovsky@email.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).