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

Re: git clone fails "with error: RPC failed; result=22, HTTP code = 401

From
Jeff King <peff@peff.net>
Date
Jul 10, 2012, 20:51 UTC
Message-ID
<20120710205128.GD23798@sigill.intra.peff.net>
In-Reply-To
<CAEpEX_7xrGR+Uk5601iKKPr0uQDkT2sQ4ziPVmqCASYy51hBCQ@mail.gmail.com>
On Fri, Jul 06, 2012 at 02:04:10PM +0200, Ilya Ruprecht wrote:
Show 12 quoted lines
>         <Location "/git/repo1.git">
>                 # read access
>                 <Limit GET>
>                         require ldap-group repo.writers
>                         require ldap-group repo.readers
>                 </Limit>
> 
>                 # write access
>                 <Limit GET PUT POST DELETE PROPPATCH MKCOL COPY MOVE
> LOCK UNLOCK>
>                         require ldap-group repo.writers
>                 </Limit>

As you noticed, this will not do what you want. Git's smart-http protocol uses POST requests to send the list of heads during ref negotiation. So even a fetch request will require both GETs and POSTs.

The right way to restrict reading versus writing over smart-http is to check which git service is being requested (confusingly, "git-upload-pack" is for clones and fetches, and "git-receive-pack" is for pushes; the names are based on what the _server_ is doing). There is an example in the git-http-backend documentation, which uses a LocationMatch along with a "require" directive.

-Peff
Previous: Ilya Ruprecht
Message 2 of 2 in “git clone fails "with error: RPC failed; result=22, HTTP code = 401”
  1. Ilya RuprechtJul 6, 2012
  2. Jeff KingJul 10, 2012

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.