Troubleshooting
The failures this guide's lab actually
met, in the order a new reader is likely
to meet them — plus the one diagnostic
that answers most questions before they
are asked. That diagnostic deserves the
first paragraph: look at the command
log, bottom-right. It names the git
command behind whatever just happened,
or failed to. Half the mysteries in this
chapter end there; the other half end in
git status, run in a plain terminal,
which tells you the state lazygit will
show when next it refreshes.
"Not in a git repository. Create a new git repository?"
You started lazygit in a folder that is
not inside a repository — or, the subtle
version, in the parent of the folder
you meant. It is a question, not an
error: y initialises a repository
there and opens on it; n exits with
"Must open lazygit in a git repository."
If you see it where you expected a
repository, you are in the wrong folder,
or the repository's .git folder is
gone — check with ls -a and git
status before initialising anything:
a fresh git init in the wrong place
creates a second, empty repository that
will confuse every tool afterwards
(chapter 4).
The welcome popup ate my keystrokes
On the very first run, the welcome box
(chapter 4) owns the keyboard until
Enter dismisses it. More generally:
while any popup, menu or editor is
open, keys go to it — letters become
text in an editor, answers in a
confirmation, and nothing reaches the
panels. The screen looking unchanged
after three purposeful keystrokes almost
always means something modal is open.
Look for the box; Esc is the nearly
universal way to close one without
committing to anything. The lab typed
most of a sentence into a confirmation
dialogue learning this, and once typed
a z into a commit message (chapter 5's
editor is an editor; it edits). Forgiven
by undo, both times — which is the
correct order of operations: close the
box, then assess.
"No files staged" — with two different causes
The same error sentence, two unrelated stories:
- You pressed
cto commit a merge whose result equals HEAD. The difference is empty, so there is nothing for an ordinary commit to hold. The merge is concluded from its own menu: pressm, choose continue. Chapter 11 tells the whole story. - You pressed
cand meant the commit-all offer. Normally that situation gets the question popup ("You have not staged any files. Commit all files?"). If instead you meet the bare error, you are likely in a state with nothing committable at all — a clean tree wearing a merge's clothes, or a detached HEAD with the editor's preconditions unmet. Read the Status panel andgit status; the state will explain the sentence.
The Files panel shows only one row
Your files are not gone; the folder tree
is collapsed. Enter on a folder row
folds it (chapter 5) — the row shows as
▶ / and the panel's border counts "1
of 1". Enter again unfolds it. The same
border count is the tell everywhere: a
panel suddenly holding fewer entries
than the repository owns has a filter, a
fold, or a narrowed mode (the merge
mode of chapter 11 narrows Files to
conflicts only, and says so in its
title). Read the title and the count
before reaching for stronger medicine.
The arrows are stale, or a push was refused
The Status panel's ↑ and ↓ counts
(chapter 12) are only as fresh as the
last fetch. If they disagree with
what the remote's web page says, press
f and look again — fetching happens
when the program opens and on an
interval the defaults put at a minute,
not continuously, and a colleague's
push five seconds ago may not have
arrived. A push refused with a
wall of git text is the same lesson from
the other side: someone fetched first.
Pull, reconcile if asked, push again.
And a push or pull that hangs or fails
with network words in it is not a
lazygit fault at all: try the same
command as plain git in a terminal, and
fix the credential or the connection
where git looks for it (chapter 16) —
the face follows the engine.
Keys do not do what the guide says
Work through, in order: Is a popup
open? (above). Is the right panel
focused? — every key in this guide is
spoken in a panel's context; d discards
in Files and drops in Stash and deletes
in Branches, all correctly. The hint bar
always names the current panel's verbs,
and ? settles any argument. Is your
version older? — lazygit --version
against the chapters' 0.66.2; menus and
keys drift between versions, and the ?
popup of your version outranks any
book, including this one. Have you
rebound the key? — a config.yml from
an earlier experiment (chapter 14)
overrides silently and forever; the
empty file is the reset.
It is frozen, or the screen is a mess
A long operation shows a spinner and is
usually innocent — a big fetch, a big
repository's refresh. A truly stuck
screen redraws correctly after the
terminal is resized (the program
repaints on resize) or after quitting
(q, or Ctrl-C in the last resort) and
restarting: lazygit keeps no state in
the repository, so restarting it costs
nothing and loses nothing but the
session. If plain git status in a
terminal is also slow or stuck, the
patient is the repository or the disk,
not the face — and that diagnosis, at
least, lazygit delivered for free.