Skip to content

Repository default branch is immutable after the first push #3572

Description

@HolgerHatGarKeineNode

A repository's default branch (HEAD) is fixed by whatever the first push creates, and there is no supported way to change it afterwards.

Repro

git push buzz HEAD:main        # local branch is actually `master`
git push buzz master relaunch-b
git push buzz --delete main
# remote: error: refusing to delete the current branch: refs/heads/main

The repo is now stuck advertising HEAD -> refs/heads/main, a branch that does not exist locally.

Why no client can fix it

Workaround

Delete the manifest pointer in object storage, then push the intended default branch first:

mc rm loc/<bucket>/repos/<community>/<owner>/<repo>/pointer
git push buzz master        # HEAD now resolves to refs/heads/master
git push buzz relaunch-b

Re-publishing the kind:30617 announcement re-seeds the pointer, so this does not require deleting the repo. Note that a repo whose pointer is missing returns 404 repository not found even for git-receive-pack, because info_refs_subprocess uses hydrate_for_read for both services (transport.rs:726).

Expected

Either a way to set the default branch (CLI flag, kind:30617 tag, or desktop setting), or resolve_published_head honouring a delete of the current HEAD branch when other branches remain.

Buzz 0.4.26, self-hosted relay ghcr.io/block/buzz:main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions