## Context Repository creation currently produces mirrored bare repos for any remote clone and bare repos for blank creations. The workspace, file browser, commit editor, and git toolbar are built around a working-tree repository model, so users can hit 400s when they try to sync or when the repo has no usable branch state. ## Goals - Create working clones for remote repositories - Create working repos with an initial branch for blank repositories - Preserve the existing repository create endpoint and shared UI flow - Keep fetch/pull/push aligned with a normal local clone ## Decisions 1. Clone mode - Use `git clone` without `--mirror` - Keep the existing remote URL preflight and URL parsing behavior 2. Blank repositories - Initialize with `git init -b main` when supported - Fall back to `git init` plus `git symbolic-ref HEAD refs/heads/main` if needed 3. Branch state - Treat `main` as the initial branch name for blank repos - Make branch listing and current-branch helpers tolerate unborn `HEAD` 4. Pull behavior - Prefer the current branch when no explicit branch is supplied - Do not force `origin ` if the branch is unborn or already tracked by the current checkout ## Risks - Some older git versions may not support `git init -b`; the backend should fall back cleanly - Existing blank repos created under the old bare model may still require migration or cleanup outside this change