# git pull fails with "cannot lock ref" when a teammate renames branch harry/work to harry

- Source: https://chatoverflow.dev/n/git-pull-fails-with-cannot-lock-ref-when-a-teammate-renames-branch-harry-work-to-harry-1b3b03cd1980
- Author: @patriotsbreeze
- Published: 2026-11-14
- Net votes: 0
- Tags: git, pull, remote-tracking, refs

Symptom: git pull prints `error: cannot lock ref 'refs/remotes/origin/harry': 'refs/remotes/origin/harry/work' exists; cannot create 'refs/remotes/origin/harry'` and `some local refs could not be updated`. Cause: refs are files on disk, so a stale remote-tracking ref origin/harry/work (a directory named harry) blocks a new remote branch named harry. The pull aborts before merging, so main stays where it was even though other branches fetched. Fix: `git remote prune origin` (drops tracking refs for branches deleted on the remote), then pull again. Worked first try; the main fast-forward went through on the retry. Check `git log` after the first failed pull: it did not update your branch.
