GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — backend: shallow clone (--depth 1) fails over stateless HTTP — missing shallow line in phase 2 response · Issue #2011 · go-git/go-git

backend: shallow clone (--depth 1) fails over stateless HTTP — missing shallow line in phase 2 response #2011

New issue
Copy link
New issue
Copy link
Open
Open
backend: shallow clone (--depth 1) fails over stateless HTTP — missing shallow line in phase 2 response#2011
Copy link
Labels
staleIssues/PRs that are marked for closure due to inactivity

Description

@Fishwaldo
Fishwaldo
opened on Apr 21, 2026
Issue body actions

Problem

When serving a git repository via `backend.Backend` (Smart HTTP, `StatelessRPC: true`), a `git clone --depth 1` fails with:

```
fatal: git fetch-pack: expected shallow list
```

This was discovered while running a self-hosted git marketplace server for Claude Code plugin marketplaces. Claude Code always clones marketplaces with `--depth 1 --recurse-submodules --shallow-submodules`, so this failure blocks every marketplace add/refresh.

Root Cause

The shallow clone protocol over stateless HTTP requires two POST requests:

Phase 1 — client sends `want + deepen 1`:

Server → shallow <hash>   ✅ go-git sends this correctly
Server → flush

Phase 2 — client sends `want + done`:

Server → shallow <hash>   ❌ go-git omits this
Server → NAK
Server → <pack data>

The client expects `shallow ` to appear again before `NAK` in the phase 2 response. go-git sends `NAK` without it, causing the client to error with `expected shallow list`.

Evidence (captured packet trace)

Without workaround — go-git phase 2 response:

fetch-pack< shallow 7aabc998...   ← phase 1 OK
fetch-pack> done
fetch-pack< NAK                   ← phase 2 missing shallow line!
fatal: git fetch-pack: expected shallow list

With workaround — intercepting the two phases manually:

fetch-pack< shallow 7aabc998...   ← phase 1 (intercepted)
fetch-pack> done
fetch-pack< shallow 7aabc998...   ← phase 2 (injected)
fetch-pack< NAK
✓ clone succeeds

Workaround

We implemented a middleware that intercepts `git-upload-pack` POST requests:

  1. Phase 1 (`want + deepen`): handle entirely ourselves, return `shallow + flush` without involving go-git
  2. Phase 2 (`want + done`): pass to go-git, then inject the `shallow ` pkt-line into the response before the NAK

This works but is fragile and shouldn't be necessary.

Environment

  • go-git: `v6.0.0-alpha.2`
  • Client: `git/2.53.0-Linux` (system git called by Claude Code)
  • Client clone flags: `git clone --depth 1 --recurse-submodules --shallow-submodules`
  • Protocol: v1

Note: I'm not deeply familiar with the git wire protocol internals — this issue was written with help from Claude Code, which also helped diagnose the problem by capturing and analysing the git packet traces.

Activity

  1. pjbgf commented on Apr 25, 2026

    @pjbgf
    pjbgf
    on Apr 25, 2026
    Member
    More actions

    @aymanbagabas any thoughts on this?

  2. aymanbagabas commented on Apr 25, 2026

    @aymanbagabas
    aymanbagabas
    on Apr 25, 2026
    Member
    More actions

    @aymanbagabas any thoughts on this?

    I think this might be fixed by #2016

  3. pjbgf commented on May 1, 2026

    @pjbgf
    pjbgf
    on May 1, 2026
    Member
    More actions

    @Fishwaldo the fix above has been merged into main. Do you mind checking whether that fixes your issue please?

  4. github-actions commented on Oct 29, 2026

    @github-actions
    github-actionsBot
    on Oct 29, 2026 – with GitHub Actions
    More actions

    To help us keep things tidy and focus on the active tasks, we've introduced a stale bot to spot issues/PRs that haven't had any activity in a while.

    This particular issue hasn't had any updates or activity in the past 90 days, so it's been labeled as 'stale'. If it remains inactive for the next 30 days, it'll be automatically closed.

    We understand everyone's busy, but if this issue is still important to you, please feel free to add a comment or make an update to keep it active.

    Thanks for your understanding and cooperation!

  5. github-actions
    added
    staleIssues/PRs that are marked for closure due to inactivity
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssues/PRs that are marked for closure due to inactivity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.