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

Re: git smart-http do not authent to allow git ls-remote to be called anonymously

From
Shawn Pearce <spearce@spearce.org>
Date
Oct 1, 2012, 00:53 UTC
Message-ID
<CAJo=hJuBHCMBv5FTh6dSkvGR=XCtKn2BRgWgTJwt6kDs49-iEg@mail.gmail.com>
In-Reply-To
<CAHtLG6Q+XO=LhnKw4hhwtOe2ROeDN1Kg=JN5GTQqdvYjk-Sv4g@mail.gmail.com>
On Sun, Sep 30, 2012 at 7:35 AM, 乙酸鋰 <ch3cooli@gmail.com> wrote:
Show 22 quoted lines
> I use smart-http on Apache.
> If nothing to be pushed / pulled, I do not want password to be
> supplied. And allow git ls-remote to run without password
>
> *.git/info/refs?service=git-upload-pack
> *.git/info/refs?service=git-receive-pack
>
> I only need authentication on
>
> *.git/git-upload-pack
> *.git/git-receive-pack
>
> /etc/apache/httpd.conf
>
> <LocationMatch "^/git/.*/git-(upload|receive)-pack$">
>     AuthType Basic
>     AuthName "staff only"
>     AuthUserFile /etc/apache/apache.pwd
>     Require valid-user
> </LocationMatch>
>
> However this does not work. It does not ask for password at all.

This sounds like a bug in your Apache configuration. I would verify it prompts for a password as expected before worrying about the Git client:

  curl -v http://localhost/git/blah/git-upload-pack

should fail with a 401 requesting access to "staff only". Once this is working, git will present authorization as necessary during the /git-upload-pack|git-receive-pack calls.

Previous: 乙酸鋰Next: Jeff King
Message 2 of 7 in “git smart-http do not authent to allow git ls-remote to be called anonymously”
  1. 乙酸鋰Sep 30, 2012
  2. Shawn PearceOct 1, 2012
  3. Jeff KingOct 1, 2012
  4. Jeff KingOct 14, 2012
  5. Jeff KingOct 31, 2012
  6. 1/2 remote-curl: hoist gzip buffer size to top of post_rpcJeff King, Oct 31, 2012
  7. 2/2 remote-curl: retry failed requests for auth even with gzipJeff King, Oct 31, 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.