Repository navigation
Description
Summary
bb marketplace add git:<url>@<branch> fails when <branch> is not the repository's default branch. git refuses the checkout with '--detach' cannot be used with '-b/-B/--orphan'. I expected bb to read the catalog from the branch I named.
Versions and environment
- bb 0.45.0 (desktop app), macOS 27.0.1, git 2.48.1
- isolated data dir,
BB_TELEMETRY=false - main at 4b12265 runs the same git commands. I did not test 0.46.0.
Steps to reproduce
octocat/Hello-World is public, has the default branch master and a second branch test, and has no marketplace.json. A working bb gets past the checkout and then reports the missing manifest.
bb marketplace add git:https://github.com/octocat/Hello-World.git@testbb marketplace add git:https://github.com/octocat/Hello-World.git@origin/testbb marketplace add git:https://github.com/octocat/Hello-World.git@master
git alone reproduces it:
cd "$(mktemp -d)"
git init -q -b main src && git -C src commit -q --allow-empty -m one && git -C src branch feature
git clone -q --no-checkout src co
git -C co checkout --detach featureExpected vs actual
$ bb marketplace add git:https://github.com/octocat/Hello-World.git@test
Error: HTTP 422: git -c failed (exit 128): fatal: '--detach' cannot be used with '-b/-B/--orphan'
$ bb marketplace add git:https://github.com/octocat/Hello-World.git@origin/test
Error: HTTP 422: ENOENT: no such file or directory, realpath '<data dir>/marketplaces/staging/<uuid>/marketplace.json'
$ bb marketplace add git:https://github.com/octocat/Hello-World.git@master
Error: HTTP 422: ENOENT: no such file or directory, realpath '<data dir>/marketplaces/staging/<uuid>/marketplace.json'
Expected: step 1 behaves like steps 2 and 3. bb checks out test and then reports the missing manifest.
Evidence
bb clones with --no-checkout and then runs git checkout --detach <ref>:
bb/apps/server/src/services/plugin-catalog/marketplace-source.ts
Lines 321 to 357 in 4b12265
| async function materializeGit( | |
| source: Extract<MarketplaceSource, { kind: "git" }>, | |
| stagingDir: string, | |
| warn: ((message: string) => void) | undefined, | |
| ): Promise<MaterializedMarketplace> { | |
| await mkdir(stagingDir, { recursive: true }); | |
| const checkout = join(stagingDir, randomUUID()); | |
| const dispose = () => rm(checkout, { recursive: true, force: true }); | |
| try { | |
| await runInstallCommand("git", [ | |
| ...GIT_CLONE_ARGS, | |
| "clone", | |
| "--quiet", | |
| "--no-checkout", | |
| source.url, | |
| checkout, | |
| ]); | |
| await runInstallCommand("git", [ | |
| ...GIT_CLONE_ARGS, | |
| "-C", | |
| checkout, | |
| "checkout", | |
| "--quiet", | |
| "--detach", | |
| source.ref, | |
| ]); | |
| const commit = await runInstallCommand("git", [ | |
| "-C", | |
| checkout, | |
| "rev-parse", | |
| "HEAD", | |
| ]); | |
| await rm(join(checkout, ".git"), { recursive: true, force: true }); | |
| return await materializeLocal(checkout, commit, dispose, warn); | |
| } catch (error) { | |
| await dispose(); | |
| throw error; |
Cause, as I read it: after the clone, the default branch is the only local branch. For another branch name, git's checkout guess creates a local branch from origin/<name>, the implicit -b in the message, and git refuses that together with --detach. I did not test tags or commit SHAs.
Possible fix: git fetch --depth 1 origin <ref>, then git checkout --detach FETCH_HEAD. In my test this checks out a non-default branch. It also replaces the full-history clone on each 2-hour refresh with a one-commit fetch. Fetching a commit SHA needs server support, which GitHub has.
What you ruled out
- Credentials: the repository is public.
- Duplicates: no open or closed issue mentions this error.
Suggested priority and effort
Low. @origin/<branch> works around it, but you need to know git internals to find that. Effort probably low.
- I reproduced this on 0.45.0. main at 4b12265 has the same code; I did not test 0.46.0.
- I searched open and closed issues for the same problem.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 12, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotplugins,confirmed-repro.Resolve marketplace Git refs before detached checkout (get-bb#5375)
Resolve local-vs-origin branch refs with one shared resolver (#7719)