How to fix fatal: '/path/to/worktree' already exists in Git

GitINTERMEDIATELOWUpdated Dec 6, 2025ยท 167 views

This error occurs when Git cannot create a worktree because the target directory already exists or is registered as an existing worktree. Fix it by removing the directory, pruning stale worktree references, or using the --force flag.

Quick fix

Fixes fatal: '/path/to/worktree' already exists

git worktree list
  1. List existing worktrees
  2. Check if the directory actually exists
  3. Prune stale worktree references
  4. Properly remove an existing worktree
git โ€” error
git worktree list
fatal: '/path/to/worktree' already exists

What this error means

The "fatal: '/path/to/worktree' already exists" error occurs when you try to add a Git worktree at a path that Git believes is already in use. Git worktrees allow you to check out multiple branches simultaneously in separate directories, all sharing the same repository data. Git maintains a record of all worktrees in the `.git/worktrees` directory of your main repository. When you run `git worktree add <path>`, Git checks both whether the filesystem path exists AND whether it's already registered as a worktree. The error can occur if either condition is true. This safety mechanism prevents you from accidentally overwriting an existing worktree or creating conflicts when the same path is tracked twice. However, it can become problematic when a worktree directory was manually deleted without using `git worktree remove`, leaving stale references in Git's tracking files.

Typical symptoms

  • git worktree add fails with 'fatal: path already exists'
  • Cannot create worktree even after manually deleting the directory
  • git worktree list shows paths that no longer exist on disk
  • Attempting to add a worktree for a branch shows it's 'already checked out'
  • Re-cloning the repository temporarily fixes the issue but it returns

Common causes

  1. Target directory already exists on the filesystem (most common)
  2. Worktree was manually deleted without using 'git worktree remove', leaving stale references
  3. Previous worktree at that path was not properly cleaned up
  4. Branch is already checked out in another worktree (related but different error)
  5. GIT_WORK_TREE or GIT_DIR environment variables are set incorrectly
  6. Filesystem permissions prevent Git from detecting the path state correctly

How to fix "fatal: '/path/to/worktree' already exists"

1List existing worktrees

First, check what worktrees Git currently knows about:

bash
git worktree list

This shows all registered worktrees with their paths and checked-out branches. Look for the path you're trying to use - if it appears here, Git already considers it an active worktree.

Example output:

bash
/home/user/project       abc1234 [main]
/home/user/project-feat  def5678 [feature-branch]
2Check if the directory actually exists

Verify whether the target path exists on your filesystem:

bash
ls -la /path/to/worktree

If the directory exists and you don't need it, remove it:

bash
rm -rf /path/to/worktree

Warning: Make sure you don't have uncommitted changes in that directory before deleting it.

3Prune stale worktree references

If the directory doesn't exist but Git still thinks it does, prune the stale references:

bash
git worktree prune

This removes administrative files for worktrees whose directories have been deleted. Use --dry-run to preview what would be removed:

bash
git worktree prune --dry-run

For verbose output showing what's being cleaned up:

bash
git worktree prune -v
4Properly remove an existing worktree

If the worktree exists and you want to replace it, remove it properly first:

bash
git worktree remove /path/to/worktree

If the worktree has uncommitted changes, you'll need to force the removal:

bash
git worktree remove --force /path/to/worktree

For a locked worktree (e.g., on a portable device), use force twice:

bash
git worktree remove --force --force /path/to/worktree
5Use --force to override the path check

If you're certain the path is safe to use, you can force Git to create the worktree:

bash
git worktree add --force /path/to/worktree branch-name

This overrides the safety check that prevents using an existing path. Use this when:
- The path exists but is empty
- You've verified no important data will be lost
- Git's tracking is out of sync with the filesystem

Note: --force does NOT override the check for a branch being checked out elsewhere. For that, you need --force twice.

6Check for environment variable interference

Environment variables can cause Git to behave unexpectedly with worktrees:

bash
echo $GIT_DIR
echo $GIT_WORK_TREE

If either is set, unset them and try again:

bash
unset GIT_DIR
unset GIT_WORK_TREE
git worktree add /path/to/worktree branch-name

This is especially common when running Git commands from within a git rebase -i session or custom Git hooks.

7Create the worktree at a different path

If the above steps don't work or you want a quick solution, simply use a different path:

bash
git worktree add /path/to/worktree-2 branch-name

Or create it in a sibling directory of your main repository:

bash
git worktree add ../my-feature feature-branch

This avoids the conflict entirely while still giving you a functional worktree.

Advanced notes

Understanding Git worktree internals: Git stores worktree metadata in .git/worktrees/<worktree-name>/. Each entry contains a gitdir file pointing back to the main repository. If you manually inspect or modify these files, you can sometimes fix issues that git worktree prune doesn't catch.

Locked worktrees: You can lock a worktree to prevent it from being pruned (useful for worktrees on removable drives):

bash
git worktree lock /path/to/worktree --reason "On USB drive"
git worktree unlock /path/to/worktree

Moving worktrees (Git 2.17+): Instead of removing and re-adding, you can move a worktree:

bash
git worktree move /old/path /new/path

Detached HEAD worktrees: If you don't want to create or check out a branch, use:

bash
git worktree add --detach /path/to/worktree HEAD

Branch already checked out: If you see "fatal: 'branch' is already checked out at '/other/path'", this is a different but related error. Git prevents the same branch from being checked out in multiple worktrees to avoid commit conflicts. Use --force to override this (not recommended) or check out a different branch.

CI/CD considerations: In CI pipelines, worktrees can accumulate between runs. Add git worktree prune to your setup steps, or use unique paths per build to avoid conflicts.

Frequently asked questions

What does "fatal: '/path/to/worktree' already exists" mean?
The "fatal: '/path/to/worktree' already exists" error occurs when you try to add a Git worktree at a path that Git believes is already in use. Git worktrees allow you to check out multiple branches simultaneously in separate directories, all sharing the same repository data. git/worktrees directory of your main repository.
How do I fix "fatal: '/path/to/worktree' already exists"?
This error occurs when Git cannot create a worktree because the target directory already exists or is registered as an existing worktree. Fix it by removing the directory, pruning stale worktree references, or using the --force flag.
What causes "fatal: '/path/to/worktree' already exists"?
Target directory already exists on the filesystem (most common) Worktree was manually deleted without using 'git worktree remove', leaving stale references Previous worktree at that path was not properly cleaned up
Is the "fatal: '/path/to/worktree' already exists" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading