Skip to content
FR
  1. LuzineDebug
  2. Git & GitHub

Git & GitHub errors: causes and fixes

The Git messages that scare people: rejected push, unrelated histories, SSH key refused, detached HEAD. How to get out of them without losing work.

! [rejected] main -> main (fetch first)

Fix "failed to push some refs" (! [rejected] fetch first) in Git

The remote repository has commits you do not have locally, so Git refuses to overwrite its history. Fetch them with git pull --reb…

Beginner 5 min
fatal: refusing to merge unrelated histories

Fix "fatal: refusing to merge unrelated histories" in Git

The two branches you are trying to merge share no commit, usually because the GitHub repository was created with a README and the…

Beginner 5 min
[email protected]: Permission denied (publickey).

Fix "Permission denied (publickey)" with Git and GitHub

The Git server accepted none of the SSH keys your computer offered. Create a key with ssh-keygen -t ed25519, load it into the SSH…

Intermediate 10 min
You are in 'detached HEAD' state. You can look around, make experimental changes and commi…

Get out of "detached HEAD" state in Git without losing commits

HEAD points directly to a commit instead of a branch. If you have not committed anything, just go back to your branch with git swi…

Beginner 5 min
error: Your local changes to the following files would be overwritten by merge:

Fix "Your local changes to the following files would be overwritten by merge" in Git

You have uncommitted changes in files that the git pull (or merge, checkout) needs to modify, and Git refuses to overwrite them. P…

Beginner 5 min
Auto-merging src/app.js

Resolve "CONFLICT (content): Merge conflict" and "Automatic merge failed" in Git

Both branches changed the same lines and Git cannot tell which one to keep. Open each conflicted file, pick the right content betw…

Beginner 15 min
remote: Support for password authentication was removed on August 13, 2021.

Fix "Support for password authentication was removed" on GitHub

GitHub no longer accepts your account password for git push or git pull over HTTPS. Sign in with gh auth login or Git Credential M…

Beginner 10 min
remote: error: File data/dump.sql is 512.00 MB; this exceeds GitHub's file size limit of 1…

Fix "GH001: Large files detected" (file over 100 MB) on GitHub

One of the commits you are pushing contains a file over 100 MB, GitHub’s limit. Deleting the file in a new commit is not enough: y…

Intermediate 20 min

Other areas