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

Re: Fwd: Git credentials not working

From
Jeff King <peff@peff.net>
Date
Oct 3, 2018, 20:43 UTC
Message-ID
<20181003204312.GC20709@sigill.intra.peff.net>
In-Reply-To
<84e704e0-fbf9-230f-459c-2927dea19a03@gmail.com>
On Thu, Oct 04, 2018 at 02:34:17AM +0700, Dimitri Kopriwa wrote:
Show 11 quoted lines
> I have replaced the way I fill the git credentials store, I have verify
> ~/.git-credentials and information are there, the ~/.gitconfig look fine
> too.
> 
> I still have 401 error when reading from that file.
> 
> This is the paste log : https://paste.gnome.org/pmntlkdw0
> 
> Now that I use git approve, I dont think that I need a custom helper.
> 
> Any idea why I still can't log in using git-credential?

Looking at your pastebin, it looks like the server sometimes takes it and sometimes not. E.g., piping the log through:

  egrep '(Send|Recv) header:' |
  perl -lpe 's/^.*?(=>|<=) //'
I see:
  Send header: GET /example-keys/sample-project.git/info/refs?service=git-upload-pack HTTP/1.1
  Send header: User-Agent: git/2.19.0
  ...
  Recv header: HTTP/1.1 401 Unauthorized
  Recv header: WWW-Authenticate: Basic realm="GitLab"
  ...
  Send header: GET /example-keys/sample-project.git/info/refs?service=git-upload-pack HTTP/1.1
  Send header: Authorization: Basic <redacted>
  Send header: User-Agent: git/2.19.0
  ...
  Recv header: HTTP/1.1 200 OK
So that works. But then later we get:
  Send header: GET /example-keys/sample-project.git/info/refs?service=git-upload-pack HTTP/1.1
  Send header: User-Agent: git/2.19.0
  ...
  Recv header: HTTP/1.1 401 Unauthorized
  Recv header: WWW-Authenticate: Basic realm="GitLab"
  ...
  Send header: GET /example-keys/sample-project.git/info/refs?service=git-upload-pack HTTP/1.1
  Send header: Authorization: Basic <redacted>
  Send header: User-Agent: git/2.19.0
  ...
  Recv header: HTTP/1.1 401 Unauthorized

And then that causes credential-store to delete the non-working entry, after which all of them must fail (because you have no working credential, and presumably no terminal to prompt the user).

I have no idea why the same request would sometimes be allowed and sometimes not. It's possible the <redacted> data is different in those two times, but I don't know why that would be. It's also possible you're hitting different load-balancing servers that behave differently.

-Peff
Previous: Bryan TurnerNext: Dimitri Kopriwa
Message 9 of 10 in “Fwd: Git credentials not working”
  1. Dimitri KopriwaOct 3, 2018
  2. Christian CouderOct 3, 2018
  3. Dimitri KopriwaOct 3, 2018
  4. Jeff KingOct 3, 2018
  5. Dimitri KopriwaOct 3, 2018
  6. Jeff KingOct 3, 2018
  7. Dimitri KopriwaOct 3, 2018
  8. Bryan TurnerOct 3, 2018
  9. Jeff KingOct 3, 2018
  10. Dimitri KopriwaOct 3, 2018

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.