Git this-operation-must-be-run-in-a-work-tree The command ran inside a bare repository or a Git directory, where no checkout exists.
Reviewed for reference consistency: August 11, 2026
Code is Safe
SECUREGit has paused the operation to protect your code. No data has been lost or corrupted.
What To Know
Where Did It Fail?
Commands That Trigger This
cd .git inside a normal repository.git after searching through config or hooksTechnical Background
Bare repositories are deliberate: servers and shared upstreams store history without any checkout, because nobody edits files there directly. The message is Git noticing that the requested command belongs to the file-side half of that split.
Nothing is wrong with the repository itself. History, branches, and objects are all intact; the command simply has no checked-out files to operate on. Commands that work purely on history — log, show, fetch — usually succeed from the same directory.
Underlying Causes
Frequently Asked Questions
A bare repository contains a HEAD file, objects, and refs at its top level, while a broken checkout would be missing the whole .git directory; `git rev-parse --is-bare-repository` answers directly.
Yes. Receiving pushes is exactly what bare repositories exist for; only commands that need a working tree are unavailable.