Skip to content

Cannot remove worktree when main repository has been deleted: "'.git' is not a .git file, error code 7" #808

Description

@pedrommone

Description

I had a worktree checked out at /Code/gpmp/grupos-inteligentes/api-renovate-fix. The main repository it belonged to (/Code/gpmp/grupos-inteligentes/api) was deleted outside of Muxy beforehand. When I tried to remove the worktree through Muxy, it failed with:

fatal: validation failed, cannot remove working tree: '/Users/pedromaia/Code/gpmp/grupos-inteligentes/api-renovate-fix/.git' is not a .git file, error code 7

I expected Muxy to detect the orphaned worktree and offer to clean it up (e.g. remove the directory and prune the stale worktree reference), or at least show a clearer message explaining that the main repository is missing.

Steps to Reproduce

  1. Open Muxy
  2. Have a worktree whose main repository has been deleted/moved outside Muxy
  3. Try to remove the worktree from Muxy
  4. Observe error code 7 and the worktree remains

Muxy Version

1.0.0

macOS Version

26.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions