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

Re: [PATCH] Prompt for a username when an HTTP request 401s

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 19, 2010, 14:16 UTC
Message-ID
<20100319141643.GA16211@spearce.org>
In-Reply-To
<alpine.DEB.2.00.1003191033022.15750@tvnag.unkk.fr>
Daniel Stenberg <daniel@haxx.se> wrote:
Show 11 quoted lines
> On Fri, 19 Mar 2010, Tay Ray Chuan wrote:
>>> When an HTTP request returns a 401, Git will currently fail with a  
>>> confusing message saying that it got a 401.
>>
>> how are you getting 401s? Recently, git set the CURL_AUTH_ANY option, 
>> so if the correct credentials are passed, curl should have "hid" the 
>> 401 from us.
>
> That's correct. It should hide the 401 in the sense that it should try to 
> continue and do the correct authentication procedure and only if that 
> fails it should end up with an actual 401 end result.

If the URL didn't contain a username, and the server returns a 401, Git just aborts with an error.

What Scott is trying to do here is teach Git to request a username/password if there was no username in the URL and authentication is required by the server.

In the case of GitHub, this means they can advertise one http:// URL for the repository. Anonymous fetch just works, and using that same URL to push will ask for your username/password, and then complete.

-- 
Shawn.
Previous: Daniel StenbergNext: Shawn O. Pearce
Message 4 of 8 in “Prompt for a username when an HTTP request 401s”
  1. Prompt for a username when an HTTP request 401sScott Chacon, Mar 19, 2010
  2. Tay Ray ChuanMar 19, 2010
  3. Daniel StenbergMar 19, 2010
  4. Shawn O. PearceMar 19, 2010
  5. Shawn O. PearceMar 19, 2010
  6. Scott ChaconMar 19, 2010
  7. Shawn O. PearceMar 19, 2010
  8. Junio C HamanoMar 19, 2010

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.