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

Re: Git dumb HTTP protocol should work without update-server-info

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 7, 2025, 15:07 UTC
Message-ID
<aL2fn4j5uhrVWrDp@fruit.crustytoothpaste.net>
In-Reply-To
<CAGiEHCtP29bQRsEyLabNrLuiP96P-o7EEGi88B7pJbP0tfprxw@mail.gmail.com>
On 2025-09-07 at 11:24:13, Milan Hauth wrote:
Show 23 quoted lines
> this works:
> 
> git ls-remote /path/to/repo2/
> git ls-remote /path/to/repo2/.git/
> git ls-remote file:///path/to/repo2/
> git ls-remote file:///path/to/repo2/.git/
> 
> this fails:
> 
> python -m http.server -d /path/to/repo2/ &
> git ls-remote http://localhost:8000/
> git ls-remote http://localhost:8000/.git/
> 
> workaround:
> 
> pushd /path/to/repo2/.git/
> git --bare update-server-info
> mv hooks/post-update.sample hooks/post-update
> popd
> git ls-remote http://localhost:8000/
> 
> expected:
> dumb http remotes should behave like file remotes

In general, that's not possible, because HTTP doesn't support native atomic operations. An HTTP push locks the remote with DAV by preventing other changes to `info/refs`, which makes the operation atomic. If that file isn't there, then there's no way to guarantee that the ref update isn't competing with others, which might cause data loss.

In addition, HTTP also doesn't support native machine-readable directory listings except with DAV. However, we don't require DAV for fetches, so we need a list of the refs and the packs in order to be able to download objects correctly.

Show 15 quoted lines
> > git --bare update-server-info
> 
> that command creates the file
> /path/to/repo2/.git/info/refs
> but that is just an optimization
> for http servers with high latency
> 
> my "dumb" http server
> is smart enough to handle http range requests
> so there is no need
> to download all the files from .git/
> 
> but also without http range requests
> this should "just work"
> and the user should be responsible for optimizations
As I said above, I don't think that's the concern here.

I will also note that the dumb HTTP protocol doesn't work with reftable and there was some suggestion of removing it for Git 3.0. It certainly will not work out of the box with Git 3.0, since the default is reftable.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Milan HauthNext: Milan Hauth
Message 2 of 11 in “Git dumb HTTP protocol should work without update-server-info”
  1. Milan HauthSep 7, 2025
  2. brian m. carlsonSep 7, 2025
  3. Milan HauthSep 7, 2025
  4. brian m. carlsonSep 7, 2025
  5. Patrick SteinhardtSep 8, 2025
  6. Junio C HamanoSep 8, 2025
  7. Patrick SteinhardtSep 9, 2025
  8. Jeff KingSep 8, 2025
  9. Junio C HamanoSep 8, 2025
  10. brian m. carlsonSep 8, 2025
  11. Jeff KingSep 9, 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.