Git errors

Git and GitHub errors: rejected pushes, merge conflicts, SSH keys and unrelated histories.

CodeErrorWhat it means
Git SSL certificate problem fatal: unable to access 'https://…': SSL certificate problem: unable to get local issuer certificate Git doesn’t trust the HTTPS server’s certificate — corporate proxy, self-hosted Git with an internal CA, or o…
kex_exchange_identification kex_exchange_identification: Connection closed by remote host The SSH connection was closed before the handshake — server overload, rate limiting, or a proxy/firewall inte…
rebase in progress fatal: It seems that there is already a rebase-merge directory, and I wonder if you are in the middle of another rebase. A previous rebase is still in progress (or was interrupted).
Repository not found remote: Repository not found. fatal: repository 'https://github.com/x/y.git/' not found GitHub/GitLab says the repository doesn’t exist — or you lack access to a private repo.
unfinished merge fatal: You have not concluded your merge (MERGE_HEAD exists). Please, commit your changes before you merge. A merge is still in progress — conflicts were resolved (or not) but not committed.
protected branch remote: error: GH006: Protected branch update failed / pre-receive hook declined The server rejected your push because of branch protection rules or a server-side hook.
Filename too long error: unable to create file x: Filename too long (Windows) Windows’ 260-character path limit blocked Git from creating a file.
workflow scope ! [remote rejected] … (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/x.yml` without `workflow` scope) Your token can’t modify GitHub Actions workflow files without the workflow scope.
overwritten by checkout error: Your local changes to the following files would be overwritten by checkout Switching branches would discard uncommitted changes in files that differ between branches.
origin not a repository fatal: 'origin' does not appear to be a git repository No remote named origin is configured (or it points nowhere valid).
GH001 large files remote: error: GH001: Large files detected. File x is 120 MB; this exceeds GitHub's file size limit of 100.00 MB GitHub rejected the push because a file over 100 MB is in your commits — even if you deleted it later.
github-actions[bot] 403 remote: Permission to owner/repo.git denied to github-actions[bot]. fatal: unable to access … The requested URL returned error: 403 A GitHub Actions workflow tried to push but the GITHUB_TOKEN doesn’t have write permission.
password auth removed remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. GitHub no longer accepts account passwords for Git over HTTPS.
untracked files overwritten error: The following untracked working tree files would be overwritten by checkout/merge Untracked local files have the same paths as files coming from the other branch.
no upstream branch fatal: The current branch x has no upstream branch. The local branch isn’t linked to a remote branch yet, so a bare git push doesn’t know where to go.
cannot rebase error: cannot pull with rebase: You have unstaged changes. Please commit or stash them. A rebase (or pull --rebase) needs a clean working tree.
branch exists fatal: a branch named 'x' already exists You tried to create a branch whose name is already taken locally.
unknown revision HEAD fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. The repository has no commits yet (or the ref doesn’t exist), so HEAD can’t be resolved.
Could not resolve host fatal: unable to access 'https://github.com/…': Could not resolve host: github.com DNS lookup for the Git host failed from this machine.
CONFLICT Git: CONFLICT (content): Merge conflict in file — Automatic merge failed Both branches changed the same lines; Git needs you to choose the final content before completing the merge/r…
publickey Git: Permission denied (publickey). fatal: Could not read from remote repository. SSH authentication to GitHub/GitLab/Bitbucket failed — no key, wrong key, or the key isn’t added to your acco…
divergent branches hint: You have divergent branches and need to specify how to reconcile them. Git 2.27+ asks you to choose merge, rebase or fast-forward-only when local and remote both have new commits.
merge commit revert error: commit x is a merge but no -m option was given. git revert or cherry-pick on a merge commit needs to know which parent is the mainline.
gpg failed to sign error: gpg failed to sign the data — fatal: failed to write commit object Commit signing is enabled but GPG couldn’t sign — no TTY for the passphrase, wrong key, or agent not running.
corrupt object error: object file .git/objects/x is empty / fatal: loose object is corrupt The local Git object database is corrupted — usually after a crash, disk full or sync tool interference.
pathspec did not match error: pathspec 'x' did not match any file(s) known to git Git couldn’t find the file or branch name you referenced.
couldn't find remote ref fatal: couldn't find remote ref main The branch you tried to pull/fetch doesn’t exist on the remote.
early EOF fatal: early EOF — fatal: index-pack failed A clone or fetch was cut off mid-transfer.
not a valid object name fatal: Not a valid object name: 'main'. The branch or commit doesn’t exist yet — typically in a new repo before the first commit.
author identity unknown Author identity unknown *** Please tell me who you are. Git doesn’t know your name and email for commits.
LFS smudge error Error downloading object: x: Smudge error / This repository is over its data quota Git LFS couldn’t download a large file — missing LFS install, auth problems, or the LFS bandwidth/storage quo…
submodule url fatal: No url found for submodule path 'x' in .gitmodules A submodule entry exists in the index but its URL is missing from .gitmodules.
not possible to fast-forward fatal: Not possible to fast-forward, aborting. pull is configured to fast-forward only, but your branch and the remote have diverged.
non-fast-forward Git: ! [rejected] … (fetch first) — error: failed to push some refs The remote branch has commits you don’t have locally, so Git refuses to overwrite them. Pull (merge or rebase…
unrelated histories Git: fatal: refusing to merge unrelated histories The two branches have no common ancestor — typically a local repo and a remote that were both initialized sep…
gc warning warning: There are too many unreachable loose objects; run 'git prune' to remove them. Git’s automatic garbage collection found many unreachable objects and is asking you to prune.
shallow update not allowed ! [remote rejected] main -> main (shallow update not allowed) You pushed from a shallow clone to a remote that doesn’t accept shallow history.
cannot lock ref error: cannot lock ref 'refs/remotes/origin/x': is at … but expected … / unable to update local ref Git couldn’t update a reference — stale remote-tracking refs, case-only branch name clashes, or a leftover lo…
src refspec error: src refspec main does not match any You pushed a branch name that doesn’t exist locally — usually no commits yet, or the branch is called master…
port 22 timed out ssh: connect to host github.com port 22: Connection timed out Outbound SSH on port 22 is blocked (firewall, corporate or public Wi-Fi).
LF/CRLF warning warning: in the working copy of 'x', LF will be replaced by CRLF the next time Git touches it Git’s line-ending conversion (core.autocrlf) will change line endings in your working copy.
detached HEAD You are in 'detached HEAD' state. HEAD points at a commit instead of a branch, so new commits won’t belong to any branch.
changes overwritten error: Your local changes to the following files would be overwritten by merge git pull/merge would modify files you’ve changed but not committed.
Authentication failed fatal: Authentication failed for 'https://github.com/x/y.git/' HTTPS authentication to the Git host failed — wrong or expired credentials, or a password used where a token…
non-bare push ! [remote rejected] main -> main (branch is currently checked out) You pushed to a non-bare repository whose working tree has that branch checked out.
remote origin exists error: remote origin already exists. A remote named origin is already configured.
not a git repository fatal: not a git repository (or any of the parent directories): .git You ran a Git command outside a Git working tree.
Host key verification failed Host key verification failed. fatal: Could not read from remote repository. SSH doesn’t trust the server’s host key — first connection in a non-interactive environment, or the key chang…
broken ref warning: ignoring broken ref refs/remotes/origin/HEAD A ref file is empty or points to a missing object — usually refs/remotes/origin/HEAD after the default branch…
index.lock exists fatal: Unable to create '.git/index.lock': File exists. Another git process seems to be running in this repository A lock file from another (or crashed) Git process blocks this command.
RPC failed error: RPC failed; HTTP 400 curl 22 / curl 92 HTTP/2 stream was not closed cleanly — the remote end hung up unexpectedly A large HTTPS push/clone broke mid-transfer — size limits, proxies or flaky HTTP/2.