// Error messages

Git error messages, translated

Git speaks in cryptic one-liners. Paste or search your message: here's what it means and how to get out of it.

fatal: not a git repository (or any of the parent directories): .git

Not a Git repository

What it means
You are in a folder that Git doesn't track: wrong folder, or git init was never run.
How to fix it
Go to your project folder, or create a repository there.
Safe
$ cd path/to/your/project
Safe
$ git init
Full guide
git@github.com: Permission denied (publickey).

Permission denied (publickey)

What it means
The server didn't accept your SSH key: no key, key not added to your account, or the agent doesn't have it.
How to fix it
Test the connection, then follow our SSH key setup.
Safe
$ ssh -T git@github.com
Full guide
remote: Support for password authentication was removed.

Password authentication refused

What it means
GitHub no longer accepts your account password over HTTPS.
How to fix it
Use an SSH key (recommended), or a personal access token instead of the password.
Full guide
! [rejected] main -> main (fetch first)
error: failed to push some refs

Push rejected

What it means
Someone pushed to the branch since your last pull.
How to fix it
Get their commits first, then push. Never fix this with --force.
Caution
$ git pull --rebase
Safe
$ git push
Full guide
fatal: The current branch feature has no upstream branch.

No upstream branch

What it means
This branch only exists locally: Git doesn't know where to push it.
How to fix it
Push it once with -u, then a plain git push is enough.
Safe
$ git push -u origin HEAD
fatal: refusing to merge unrelated histories

Unrelated histories

What it means
Usually: you created a README on GitHub and also committed locally. The two histories have no common commit.
How to fix it
Allow the merge once, then resolve conflicts if any.
Caution
$ git pull origin main --allow-unrelated-histories
Your branch and 'origin/main' have diverged

Your branch has diverged

What it means
You have local commits and the remote has others. Git asks how to combine them.
How to fix it
Rebase your commits on top (linear history), and set it as the default.
Caution
$ git pull --rebase
Safe
$ git config --global pull.rebase true
error: Your local changes to the following files would be overwritten by checkout

Local changes would be overwritten

What it means
You have uncommitted changes that conflict with the branch or the pull.
How to fix it
Put them aside with stash, do your operation, then bring them back.
Safe
$ git stash push -u -m "wip"
Caution
$ git stash pop
error: remote origin already exists.

Remote already exists

What it means
An “origin” remote is already configured.
How to fix it
Change its URL instead of adding it again.
Safe
$ git remote -v
Caution
$ git remote set-url origin git@github.com:OWNER/REPO.git
error: src refspec main does not match any

src refspec does not match any

What it means
The branch you push doesn't exist yet: no commit made, or it's called master, not main.
How to fix it
Check the branch name and make at least one commit.
Safe
$ git branch
Safe
$ git commit -m "chore: initial commit"
error: pathspec 'feature/x' did not match any file(s) known to git

pathspec did not match

What it means
A typo in the branch or file name, or the branch exists only on the remote and wasn't fetched.
How to fix it
Fetch, then list the branches to find the exact name.
Safe
$ git fetch origin
Safe
$ git branch -a
fatal: Unable to create '.git/index.lock': File exists.

index.lock already exists

What it means
Another Git process is running (or crashed and left its lock file).
How to fix it
Close your editor's Git panel and other terminals. If no Git command is running, delete the lock.
Caution
$ rm .git/index.lock
CONFLICT (content): Merge conflict in src/app.ts

Merge conflict

What it means
Both sides changed the same lines.
How to fix it
Edit the files, remove the markers, then add and commit — or abort.
Safe
$ git merge --abort
Full guide
remote: error: File big.zip is 245.00 MB; this exceeds GitHub's file size limit of 100.00 MB

File too large for GitHub

What it means
A file over 100 MB is in one of the commits you are pushing.
How to fix it
Remove it from history before pushing (and use Git LFS for big files).
Full guide
warning: LF will be replaced by CRLF the next time Git touches it

LF / CRLF warning

What it means
Windows and Linux/macOS don't end lines the same way. It's a warning, not an error.
How to fix it
On Windows, let Git convert automatically. In a team, a .gitattributes file settles it for everyone.
Safe
$ git config --global core.autocrlf true
nothing to commit, working tree clean

Nothing to commit

What it means
Git sees no change: files not saved, changes not staged with git add, or the files are ignored.
How to fix it
Save your files, stage them, and check they are not ignored.
Safe
$ git status
Safe
$ git check-ignore -v path/to/file
fatal: unable to access 'https://github.com/…': Could not resolve host: github.com

Cannot reach the server

What it means
A network problem: no connection, a proxy, a VPN, or a company firewall.
How to fix it
Check your connection, and the URL of the remote.
Safe
$ git remote -v
Safe
$ ping github.com
You are in 'detached HEAD' state.

Detached HEAD

What it means
You checked out a commit or a tag instead of a branch.
How to fix it
Create a branch to keep your work, or go back to your branch.
Safe
$ git switch -c rescue/detached-work
Full guide
remote: Repository not found.
fatal: repository 'https://github.com/OWNER/REPO.git/' not found

Repository not found

What it means
Wrong URL (typo, renamed repository), or a private repository your account can't access.
How to fix it
Check the URL, then your access rights. Signed in with the right account?
Safe
$ git remote -v
Caution
$ git remote set-url origin git@github.com:OWNER/REPO.git
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

No remote called origin

What it means
The repository has no remote yet (created with git init), or it has another name.
How to fix it
List the remotes, and add origin if it's missing.
Safe
$ git remote -v
Safe
$ git remote add origin git@github.com:OWNER/REPO.git
Full guide
error: RPC failed; HTTP 413 curl 22
fatal: the remote end hung up unexpectedly

The server hung up during the push

What it means
A push too big for HTTPS (large files, many commits), or an unstable connection.
How to fix it
Prefer SSH, remove large files from history (or use Git LFS), or push in smaller pieces.
Caution
$ git remote set-url origin git@github.com:OWNER/REPO.git
Safe
$ git push origin HEAD~10:main
Full guide
Host key verification failed.
fatal: Could not read from remote repository.

Host key verification failed

What it means
SSH doesn't know (or no longer recognises) the server. The first connection must be confirmed.
How to fix it
Connect once and answer “yes” after checking the fingerprint on the host's documentation. If the key changed, remove the old one first.
Safe
$ ssh -T git@github.com
Caution
$ ssh-keygen -R github.com
Full guide
fatal: could not read Username for 'https://github.com': terminal prompts disabled

Git can't ask for your credentials

What it means
HTTPS remote, no saved credentials, and no terminal to ask (IDE, CI, script).
How to fix it
Switch the remote to SSH, or set up a credential manager / token.
Caution
$ git remote set-url origin git@github.com:OWNER/REPO.git
Full guide
! [remote rejected] main -> main (protected branch hook declined)

Protected branch

What it means
The branch only accepts changes through pull / merge requests (and maybe reviews or CI).
How to fix it
Push your work on a new branch and open a pull request. That's the protection doing its job.
Safe
$ git switch -c fix/my-change
Safe
$ git push -u origin HEAD
remote: error: GH013: Repository rule violations found
remote: - Push cannot contain secrets

Push blocked: a secret was detected

What it means
GitHub found a key or token in the commits you are pushing. Good news: it never left your machine.
How to fix it
Remove the secret from the commits (amend the last one, or rewrite the unpushed ones), move it to .env, then push again. Rotate it if in doubt.
Safe
$ git rm --cached .env
Caution
$ git commit --amend --no-edit
Full guide
fatal: shallow update not allowed

Shallow clone

What it means
The repository was cloned with --depth (common in CI): part of the history is missing.
How to fix it
Download the full history.
Safe
$ git fetch --unshallow
fatal: The upstream branch of your current branch does not match the name of your current branch.

Upstream branch with another name

What it means
Your local branch tracks a remote branch with a different name.
How to fix it
Push to a branch of the same name, or fix the tracking.
Safe
$ git push -u origin HEAD
Safe
$ git branch -u origin/my-branch
error: cannot lock ref 'refs/remotes/origin/feature/login': 'refs/remotes/origin/feature' exists

cannot lock ref

What it means
A stale remote branch conflicts with a new one (e.g. “feature” and “feature/login”).
How to fix it
Clean up the remote branches that no longer exist.
Safe
$ git fetch --prune
Your branch is ahead of 'origin/main' by 3 commits.

Your branch is ahead

What it means
Not an error: you have local commits not pushed yet.
How to fix it
Push them when you're ready.
Safe
$ git log --oneline origin/main..HEAD
Safe
$ git push
Your branch is behind 'origin/main' by 4 commits, and can be fast-forwarded.

Your branch is behind

What it means
Not an error: the remote has new commits you don't have.
How to fix it
Pull them.
Safe
$ git pull
fatal: You have not concluded your merge (MERGE_HEAD exists).

A merge is still in progress

What it means
A previous merge stopped on conflicts and was never finished.
How to fix it
Finish it (resolve, add, commit) or cancel it.
Safe
$ git status
Safe
$ git merge --abort
Full guide
fatal: It seems that there is already a rebase-merge directory, and I wonder if you are in the middle of another rebase.

A rebase is still in progress

What it means
A previous rebase was interrupted (conflict, closed terminal).
How to fix it
Continue it or abort it. Only if both refuse, remove the leftover folder.
Caution
$ git rebase --continue
Safe
$ git rebase --abort
Destructive
$ rm -rf .git/rebase-merge
Full guide
error: cannot pull with rebase: You have unstaged changes.

Unstaged changes block the rebase

What it means
Rebase needs a clean working directory.
How to fix it
Let Git stash and restore them automatically.
Caution
$ git pull --rebase --autostash
Safe
$ git config --global rebase.autoStash true
fatal: Not possible to fast-forward, aborting.

Fast-forward impossible

What it means
Your config only allows fast-forward pulls, but your branch and the remote have diverged.
How to fix it
Choose explicitly: rebase your commits, or merge.
Caution
$ git pull --rebase
Safe
$ git pull --no-rebase
error: The following untracked working tree files would be overwritten by checkout:

Untracked files would be overwritten

What it means
Files that Git doesn't track exist where the other branch has files with the same name.
How to fix it
Move them away, or stash them including untracked files. Check before deleting anything.
Safe
$ git stash push -u -m "before switch"
Safe
$ git clean -n
CONFLICT (content): Merge conflict in app.ts
The stash entry is kept in case you need it again.

Conflict when applying a stash

What it means
The stashed changes conflict with the current code. The stash is kept, nothing is lost.
How to fix it
Resolve the conflicts, then drop the stash yourself.
Safe
$ git status
Caution
$ git stash drop
Full guide
error: The branch 'feature/x' is not fully merged.

Branch not fully merged

What it means
git branch -d protects you: this branch has commits that exist nowhere else.
How to fix it
Check what would be lost. Force the deletion only if you're sure.
Safe
$ git log --oneline main..feature/x
Destructive
$ git branch -D feature/x
fatal: a branch named 'feature/x' already exists

Branch already exists

What it means
You tried to create a branch with a name that's taken.
How to fix it
Switch to it, or choose another name.
Safe
$ git switch feature/x
fatal: tag 'v1.2.0' already exists

Tag already exists

What it means
A tag with this name exists locally or on the remote. Tags are meant to never move.
How to fix it
Create a new version number. Moving a published tag breaks everyone who uses it.
Safe
$ git tag --list "v1.*"
Caution
$ git fetch --tags --force
Full guide
fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.

Unknown revision

What it means
The commit, branch or file doesn't exist (typo, or no commit before HEAD in a new repository).
How to fix it
Check the name. To mean a file, separate it with --.
Safe
$ git log --oneline -n 5
Safe
$ git log -- path/to/file
fatal: your current branch 'main' does not have any commits yet

No commit yet

What it means
The repository is brand new: the branch exists only once the first commit is made.
How to fix it
Make the first commit.
Safe
$ git add .
$ git commit -m "chore: initial commit"
Full guide
fatal: detected dubious ownership in repository at '/path/to/repo'

Dubious ownership

What it means
The folder belongs to another user (copied from another disk, Docker, WSL…). Git refuses for safety.
How to fix it
If you trust this folder, mark it as safe.
Caution
$ git config --global --add safe.directory /path/to/repo
error: insufficient permission for adding an object to repository database .git/objects

Insufficient permission on .git

What it means
Some files in .git belong to root: usually after running a git command with sudo.
How to fix it
Give the folder back to your user. And never use sudo with git.
Caution
$ sudo chown -R "$(whoami)" .git
error: object file .git/objects/ab/cdef… is empty
fatal: loose object abcdef… is corrupt

Corrupted repository

What it means
Files in .git were damaged (crash, full disk, sync tool like Dropbox / OneDrive).
How to fix it
Back up the whole folder first. Then check, and if needed re-clone and copy your changes over.
Safe
$ git fsck --full
Full guide
warning: adding embedded git repository: vendor/lib

A repository inside the repository

What it means
A sub-folder has its own .git (often a cloned library). Only a pointer is added, not its files.
How to fix it
Either remove the inner .git to keep the files, or make it a proper submodule.
Safe
$ git rm --cached vendor/lib
Safe
$ git submodule add https://github.com/OWNER/lib.git vendor/lib
Full guide
fatal: in unpopulated submodule 'vendor/lib'

Empty submodule folder

What it means
Cloning doesn't download submodules by default.
How to fix it
Initialise and download them.
Safe
$ git submodule update --init --recursive
Full guide
error: unable to create file src/…/very/long/path.ts: Filename too long

Filename too long (Windows)

What it means
Windows limits paths to 260 characters by default.
How to fix it
Allow long paths in Git (and in Windows if needed).
Safe
$ git config --global core.longpaths true
error: invalid path 'docs/notes:draft.md'

Invalid path (Windows)

What it means
A file name contains a character or a name that Windows forbids (: * ? " < > |, aux, con…).
How to fix it
Rename the file from macOS / Linux (or on GitHub), commit, then pull again on Windows.
Safe
$ git mv "docs/notes:draft.md" docs/notes-draft.md
error: gpg failed to sign the data
fatal: failed to write commit object

Commit signing failed

What it means
Commit signing is enabled but GPG can't ask for the passphrase or can't find the key.
How to fix it
Tell GPG which terminal to use, check the configured key, or sign with your SSH key instead.
Safe
$ export GPG_TTY=$(tty)
Safe
$ git config --global user.signingkey
Full guide
Changes not staged for commit:
  modified:   src/app.ts

Changes not staged

What it means
Not an error: you changed files but didn't git add them, so they won't be in the commit.
How to fix it
Stage what you want to commit.
Safe
$ git add -p
Safe
$ git add path/to/file
Full guide
*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

fatal: unable to auto-detect email address

Please tell me who you are

What it means
Git signs every commit with a name and an email, and none is configured on this machine.
How to fix it
Set your name and email once, globally. Use your GitHub email so commits are linked to your account.
Safe
$ git config --global user.name "Ada Lovelace"
Safe
$ git config --global user.email "ada@example.com"
Full guide
git: 'stauts' is not a git command. See 'git --help'.

The most similar command is
	status

“…” is not a git command

What it means
A typo, a command from another tool, or an alias that doesn't exist on this machine.
How to fix it
Read Git's suggestion just below the error. Let Git ask before correcting typos automatically.
Safe
$ git config --global help.autocorrect prompt
Full guide
error: unknown option `hard'
usage: git commit [<options>] [--] <pathspec>...

Unknown option

What it means
The option doesn't exist for this command (or for your Git version), or a dash is missing (-m vs --message).
How to fix it
Check the usage line Git prints, and your Git version: recent options (git switch, git restore) need Git 2.23+.
Safe
$ git --version
error: switch `m' requires a value

Option requires a value

What it means
The option needs something after it: usually a commit message lost because of quotes (single quotes on Windows cmd).
How to fix it
Use double quotes around the message.
Safe
$ git commit -m "fix: login button on Safari"
fatal: bad config line 12 in file .git/config

Bad config line

What it means
A configuration file was edited by hand and has a syntax error (quote, bracket, encoding).
How to fix it
Open the file named in the error at that line and fix it, or reset the faulty setting.
Safe
$ git config --global --edit
Safe
$ git config --local --edit
Full guide
hint: Waiting for your editor to close the file...

Waiting for your editor to close the file

What it means
Git opened your editor (VS Code, Notepad…) for a message and waits until you close that tab or window.
How to fix it
Write the message, save, close the tab. For VS Code, configure it with --wait.
Safe
$ git config --global core.editor "code --wait"
error: There was a problem with the editor 'vi'.
Please supply the message using either -m or -F option.

There was a problem with the editor

What it means
The editor was closed without saving, crashed, or isn't installed.
How to fix it
Give the message with -m, or set an editor you have.
Safe
$ git commit -m "message"
Safe
$ git config --global core.editor nano
Please enter a commit message to explain why this merge is necessary,
especially if it merges an updated upstream into a topic branch.

Stuck in an editor asking why this merge is necessary

What it means
git pull created a merge commit and opened Vim for its message. Nothing is broken: Git waits for you.
How to fix it
In Vim: press Esc, type :wq and Enter to accept. To avoid it next time, pull with rebase.
Safe
$ git config --global pull.rebase true
Full guide
E325: ATTENTION
Found a swap file by the name ".git/.COMMIT_EDITMSG.swp"

Vim found a swap file

What it means
A previous Vim session on the commit message crashed or is still open somewhere.
How to fix it
Press D to delete the swap file (if no other Vim is open), then continue.
Caution
$ rm .git/.COMMIT_EDITMSG.swp
fatal: destination path 'my-project' already exists and is not an empty directory.

Destination path already exists

What it means
git clone creates a new folder, and a non-empty folder with that name is already there.
How to fix it
Clone into another folder name, or go into the existing folder: it may already be the project.
Safe
$ git clone https://github.com/owner/repo.git my-project-2
Full guide
warning: You appear to have cloned an empty repository.

You cloned an empty repository

What it means
The repository exists but has no commit yet. Not an error.
How to fix it
Add files, make the first commit and push it.
Safe
$ git add .
Safe
$ git commit -m "Initial commit"
Safe
$ git push -u origin main
Full guide
fatal: could not create work tree dir 'repo': Permission denied

Could not create work tree dir

What it means
You are cloning into a folder where you can't write (system folder, another user's folder).
How to fix it
Clone into your own folders (Documents, home).
Safe
$ cd ~
fatal: unable to access 'https://github.com/owner/repo.git/': SSL certificate problem: unable to get local issuer certificate

SSL certificate problem

What it means
Your network (company proxy, antivirus) intercepts HTTPS, or Git doesn't use your system's certificates.
How to fix it
On Windows, let Git use the system certificates. Never disable sslVerify for good: it opens you to attacks.
Safe
$ git config --global http.sslBackend schannel
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

SSH port 22 blocked

What it means
Your network (school, company, public Wi-Fi) blocks SSH on port 22.
How to fix it
GitHub also accepts SSH on port 443: add this to ~/.ssh/config. Or use HTTPS.
Safe
$ Host github.com
$ Hostname ssh.github.com
$ Port 443
$ User git
Full guide
remote: Permission to owner/repo.git denied to other-user.
fatal: unable to access 'https://github.com/owner/repo.git/': The requested URL returned error: 403

Permission denied (403)

What it means
You are authenticated, but as an account that can't push here: an old account remembered by your credential manager, or no write access.
How to fix it
Clear the stored GitHub credentials (they are asked again at the next push), or ask the owner for write access.
Caution
$ git credential reject <<< $'protocol=https\nhost=github.com\n'
error: No such remote 'upstream'

No such remote

What it means
The remote name is wrong or was never added (upstream is common after a fork).
How to fix it
List your remotes, then add the missing one.
Safe
$ git remote -v
Safe
$ git remote add upstream https://github.com/original/repo.git
Full guide
fatal: No configured push destination.

No configured push destination

What it means
The repository has no remote: it was created with git init and never linked to GitHub / GitLab.
How to fix it
Create the repository online, add it as origin, then push.
Safe
$ git remote add origin https://github.com/owner/repo.git
Safe
$ git push -u origin main
Full guide
fatal: couldn't find remote ref feature/login

Couldn't find remote ref

What it means
The branch you pull or fetch doesn't exist on the server: typo, already deleted, or never pushed.
How to fix it
List the remote branches and use the exact name.
Safe
$ git ls-remote --heads origin
Your branch is based on 'origin/feature/login', but the upstream is gone.

The upstream is gone

What it means
The remote branch was deleted (usually after its pull request was merged).
How to fix it
If the work is merged, switch to main and delete the local branch. Otherwise push it again.
Safe
$ git switch main && git pull
Safe
$ git branch -d feature/login
Full guide
remote: error: refusing to update checked out branch: refs/heads/main

Refusing to update checked out branch

What it means
You push to a normal repository (with files) whose current branch is the one you push: it would desync its files.
How to fix it
Push to a bare repository (git init --bare) or to another branch.
Safe
$ git init --bare /srv/git/project.git
fatal: refusing to fetch into branch 'refs/heads/main' checked out at '/home/me/project'

Refusing to fetch into the current branch

What it means
git fetch origin main:main updates a local branch directly, but it is the one you are on.
How to fix it
On the current branch, use git pull instead.
Safe
$ git pull --rebase
fatal: invalid reference: feature/login

Invalid reference

What it means
The branch or commit you name doesn't exist locally (typo, or only on the remote and not fetched).
How to fix it
Fetch, then check the exact name.
Safe
$ git fetch
Safe
$ git branch -a
fatal: 'origin/feature' is not a commit and a branch 'feature' cannot be created from it

Not a commit: branch cannot be created

What it means
You create a branch from a remote branch your repository doesn't know yet.
How to fix it
Fetch first, then create it.
Safe
$ git fetch origin
Safe
$ git switch feature
fatal: Not a valid object name: 'main'.

Not a valid object name

What it means
Usually a brand-new repository: there is no commit yet, so no branch to start from.
How to fix it
Make a first commit, then create your branches.
Safe
$ git commit --allow-empty -m "Initial commit"
warning: refname 'main' is ambiguous.

Refname is ambiguous

What it means
Two things have the same name: often a branch and a tag (main), or a branch called origin/main.
How to fix it
Find the duplicate and rename or delete the wrong one.
Safe
$ git show-ref main
fatal: 'main' is already checked out at '/home/me/project'

Branch already checked out in another worktree

What it means
With git worktree, a branch can only be checked out in one folder at a time.
How to fix it
Use the other folder, or remove the worktree you don't need.
Safe
$ git worktree list
Caution
$ git worktree remove ../old-folder
error: Cannot delete branch 'feature' checked out at '/home/me/project'

Cannot delete the current branch

What it means
You are on the branch you try to delete.
How to fix it
Switch to another branch first.
Safe
$ git switch main
Safe
$ git branch -d feature
Full guide
warning: ignoring broken ref refs/remotes/origin/HEAD

Ignoring broken ref

What it means
A ref points to something that no longer exists (often origin/HEAD after the default branch was renamed).
How to fix it
Let Git recompute it.
Safe
$ git remote set-head origin --auto
fatal: No names found, cannot describe anything.

No names found to describe

What it means
git describe needs an annotated tag, and there is none.
How to fix it
Create an annotated tag, or allow lightweight tags.
Safe
$ git tag -a v0.1.0 -m "First version"
Safe
$ git describe --tags --always
Aborting commit due to empty commit message.

Aborting commit due to empty commit message

What it means
The editor was closed without writing a message, so Git cancelled the commit. Nothing is lost.
How to fix it
Commit again with a message.
Safe
$ git commit -m "feat: what you changed"
Full guide
fatal: cannot do a partial commit during a merge.

Cannot do a partial commit during a merge

What it means
During a merge, a commit takes everything: git commit <file> isn't allowed.
How to fix it
Add the resolved files, then commit without file names.
Safe
$ git add .
Safe
$ git commit
Full guide
error: could not apply 3f2a1b9... feat: login form
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".

Could not apply a commit (rebase conflict)

What it means
During a rebase or cherry-pick, a commit touches lines changed elsewhere: Git stops for you to choose.
How to fix it
Fix the conflicted files, add them, continue. Or abort to get back to before.
Safe
$ git status
Safe
$ git add . && git rebase --continue
Safe
$ git rebase --abort
Full guide
CONFLICT (modify/delete): src/old.ts deleted in HEAD and modified in feature. Version feature of src/old.ts left in tree.

Conflict: modified on one side, deleted on the other

What it means
One branch deleted a file that the other one changed. Git can't guess which side is right.
How to fix it
Keep the file (git add) or confirm the deletion (git rm), then continue.
Safe
$ git add src/old.ts
Caution
$ git rm src/old.ts
Full guide
error: commit 4b1c2d3 is a merge but no -m option was given.

Commit is a merge but no -m option was given

What it means
To revert or cherry-pick a merge, Git must know which parent is the main line.
How to fix it
Use -m 1 (the branch you merged into, usually main).
Caution
$ git revert -m 1 4b1c2d3
Full guide
The previous cherry-pick is now empty, possibly due to conflict resolution.

The cherry-pick is now empty

What it means
The change is already on this branch: after conflicts, nothing is left to apply.
How to fix it
Skip it.
Safe
$ git cherry-pick --skip
error: You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).

A cherry-pick is in progress

What it means
A cherry-pick stopped on conflicts and was never finished.
How to fix it
Finish it or abort it.
Safe
$ git cherry-pick --continue
Safe
$ git cherry-pick --abort
fatal: There is no merge to abort (MERGE_HEAD missing).

There is no merge to abort

What it means
The merge is already finished (committed) or never started.
How to fix it
To undo a merge that is already done and not pushed, go back to ORIG_HEAD.
Destructive
$ git reset --merge ORIG_HEAD
Full guide
fatal: No rebase in progress?

No rebase in progress

What it means
You ran rebase --continue/--abort but there is no rebase going on.
How to fix it
Check the state; a finished rebase can be undone with the reflog.
Safe
$ git status
Safe
$ git reflog -n 15
No stash entries found.

No stash entries found

What it means
The stash list is empty (or the stash number doesn't exist).
How to fix it
List your stashes. A stash dropped by mistake can sometimes be found back.
Safe
$ git stash list
Safe
$ git fsck --unreachable | grep commit
Full guide
error: bad signature 0x00000000
fatal: index file corrupt

Index file corrupt

What it means
The .git/index file was damaged (crash, full disk, sync tool like OneDrive or Dropbox).
How to fix it
The index can be rebuilt from the last commit; your files are not touched.
Caution
$ rm .git/index
Safe
$ git reset
Full guide
remote: warning: File assets/video.mp4 is 62.00 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB

File larger than GitHub's recommended 50 MB

What it means
The push worked, but this file makes the repository heavy forever. Above 100 MB, GitHub refuses.
How to fix it
Move such files to Git LFS.
Safe
$ git lfs track "*.mp4"
Full guide
Encountered 3 file(s) that should have been pointers, but weren't:

Files should have been LFS pointers

What it means
Files matching .gitattributes LFS rules were committed without LFS (LFS not installed when committing).
How to fix it
Install LFS, then renormalize those files.
Safe
$ git lfs install
Safe
$ git add --renormalize . && git commit -m "chore: move files to LFS"
fatal: Cannot update paths and switch to branch 'feature' at the same time.

Cannot update paths and switch branch at the same time

What it means
git checkout got both a branch and file names, often because the remote branch isn't fetched yet.
How to fix it
Fetch, then switch with the modern command.
Safe
$ git fetch origin
Safe
$ git switch feature
This branch has conflicts that must be resolved

This branch has conflicts that must be resolved

What it means
main changed the same lines as your pull request since you opened it.
How to fix it
Merge or rebase main into your branch locally, fix the conflicts, push.
Safe
$ git fetch origin
$ git merge origin/main
Full guide
This branch is out-of-date with the base branch

This branch is out-of-date with the base branch

What it means
The repository requires PR branches to contain the latest main before merging.
How to fix it
Click “Update branch”, or merge/rebase main locally and push.
Safe
$ git fetch origin
$ git merge origin/main
$ git push
Full guide
Merging is blocked
Review required: at least 1 approving review is required by reviewers with write access.

Merging is blocked: review required

What it means
Branch protection requires someone else's approval before merging.
How to fix it
Request a review (Reviewers, top right). Pushing new commits may dismiss old approvals.
Safe
$ gh pr edit 123 --add-reviewer teammate
Full guide
Some checks were not successful
Required statuses must pass before merging

Required checks must pass before merging

What it means
A CI job (lint, tests, build) failed or is still running, and the repository requires it.
How to fix it
Open the failing check's details, reproduce locally, push a fix.
Safe
$ gh pr checks 123
Full guide
There isn't anything to compare.
main and feature are identical.

There isn't anything to compare

What it means
Your branch has no commit that the base doesn't already have: not pushed, or committed on another branch.
How to fix it
Check your commits are on this branch and pushed.
Safe
$ git log --oneline origin/main..HEAD
Safe
$ git push -u origin HEAD
a pull request for branch "feature" into branch "main" already exists:
https://github.com/owner/repo/pull/123

A pull request for this branch already exists

What it means
One branch = one open PR. Yours is already open: pushing updates it.
How to fix it
Just push to the branch; or open the existing PR from the link.
Safe
$ gh pr view --web
aborted: you must first push the current branch to a remote, or use the --head flag

You must first push the current branch

What it means
gh pr create needs your branch to exist on GitHub.
How to fix it
Push it, then create the PR.
Safe
$ git push -u origin HEAD
$ gh pr create --fill