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

Re: Failing to push to a repository erases authentication helper credentials

From
Michal Suchánek <msuchanek@suse.de>
Date
Jun 30, 2025, 15:09 UTC
Message-ID
<aGKokqPJPh5fQ3fc@kitsune.suse.cz>
In-Reply-To
<aGKfs5VRdmnw6Pqc@fruit.crustytoothpaste.net>
On Mon, Jun 30, 2025 at 02:31:15PM +0000, brian m. carlson wrote:
Show 20 quoted lines
> On 2025-06-30 at 13:45:30, Michal Suchánek wrote:
> > I was trying out AGit https://docs.gitea.com/usage/agit with oauth
> > helper https://github.com/hickford/git-credential-oauth encountering
> > this bug https://github.com/go-gitea/gitea/issues/34583
> > 
> > When doing so the oauth helper asked for new authentication, then for
> > some reason I was asked for authentication by some other helper.
> > 
> > After that pushing to repository to which I have permissions asked for
> > authentication again.
> > 
> > This hints that any failed git operation erases helper credentials.
> 
> This is true and it's by design.
> 
> > That does not sound like a desirable behavior.
> 
> It is in fact desirable because otherwise the user continues to attempt
> to use the bad credentials and then can never again authenticate
> successfully, since they are never again prompted for credentials.

My proglem is that the credentials are actually valid, only the operation is not. The current behavior erases valid credentials.

Show 5 quoted lines
> > Could the previous credentials be preserved?
> 
> Git doesn't have a behaviour to do so, but you could of course craft a
> custom credential helper that just rejects the erase command and passes
> everything else through to another helper.  That would achieve your

I do not want to use another helper. I want to preserve the last valid credentials.

Of course, using credentials that are not maintained by git at all (such as ssh authentication) does not have this problem. Only git-managed credentials get erased on invalid operation.

Thanks
Michal
Previous: brian m. carlsonNext: brian m. carlson
Message 3 of 8 in “Failing to push to a repository erases authentication helper credentials”
  1. Michal SuchánekJun 30, 2025
  2. brian m. carlsonJun 30, 2025
  3. Michal SuchánekJun 30, 2025
  4. brian m. carlsonJun 30, 2025
  5. Michal SuchánekJul 1, 2025
  6. Michal SuchánekJul 1, 2025
  7. Junio C HamanoJul 1, 2025
  8. Michal SuchánekJul 3, 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.