git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Peter Georg <peter.georg@physik.uni-regensburg.de>
Cc: git@vger.kernel.org
Subject: Re: [Bug] git-http-push authentication fails using netrc-file since v2.46
Date: Tue, 18 Feb 2025 22:53:21 +0000	[thread overview]
Message-ID: <Z7UPYY24uk7lLzeP@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <2f9629f6-d742-4ee4-8441-8b70981a4629@physik.uni-regensburg.de>

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

On 2025-02-18 at 21:34:59, Peter Georg wrote:
> When pushing to a https remote git used to use the credentials specified in
> netrc-file. I have not configured any other credential stores.
> Since Git 2.46, in particular since commit
> 
> 610cbc1dfb4ad947b82d7312c54c7987177f979f
> http: allow authenticating proactively
> 
> this is not the case anymore. With http.proactiveAuth not set or set to none
> git uses the credentials provided in netrc-file at first correctly, but at
> later connections uses empty credentials and fails with:
> 
> error: Cannot access URL https://<redacted>, return code 22
> 
> fatal: git-http-push failed

This does sound like a problem.  We've long had code to use the netrc
but absolutely zero tests or documentation for it.  I must admit that
I'm not even sure how it works, so I'll need to do some testing.

> With http.proactiveAuth set to auto or basic Git asks for credentials on
> prompt. Should it use the credentials specified in netrc-file?

I hadn't intended `http.proactiveAuth` to work that way.  It's
specifically designed to call the credential helper because it may get
credentials back which are not a username and password (say, a Bearer
token), which it can't do with a netrc file.

Also, from the documentation, it specifically looks like the netrc file
is only used if no credentials are provided, and since we can't query
libcurl to tell us if we would have credentials from the netrc file, I
don't see how we could support the netrc file since we'd have to take
the risk that there are no credentials and we'd get a 401 (which is
exactly what the feature intends to avoid).

> With http.proactiveAuth not set or set to none and no credential specified
> in .netrc a git-push asks me twice for my credentials and then fails with
> the same error as with credentials specified in netrc-file.

I'll start taking a look at this tonight, but it may be later this week
before I get time to write and send a patch.

In the meantime, you can use the git-credential-netrc helper from the
contrib directory, which will probably let you get back to normal.
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA

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

  reply	other threads:[~2025-02-18 22:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18 21:34 [Bug] git-http-push authentication fails using netrc-file since v2.46 Peter Georg
2025-02-18 22:53 ` brian m. carlson [this message]
2025-02-23  1:53   ` [PATCH 0/1] Fix netrc usage with WebDAV-based HTTP protocol brian m. carlson
2025-02-23  1:53     ` [PATCH 1/1] http: allow using netrc for " brian m. carlson
2025-02-24 16:46     ` [PATCH 0/1] Fix netrc usage with " Junio C Hamano
2025-02-24 22:09       ` brian m. carlson
2025-02-26 12:38     ` Peter Georg

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

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

  git send-email \
    --in-reply-to=Z7UPYY24uk7lLzeP@tapette.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=peter.georg@physik.uni-regensburg.de \
    /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.
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 NNTP newsgroup(s).