Common causes
- You ran git init locally and the remote repo was initialized independently (e.g. with a README on GitHub)
- You're trying to merge two completely separate Git repositories
- A force-push wiped the shared history on the remote
- You're pulling from a different repository than the one you branched from
How to fix it
- Allow the merge explicitly with the flag: git pull origin main --allow-unrelated-histories
- Resolve any merge conflicts that appear, then commit
- If starting fresh, clone the remote instead of initializing locally: git clone <url>
- If you meant to use a different remote, check your remote URL: git remote -v
Example
fatal: refusing to merge unrelated historiesRunning git pull after git init locally and creating a repo on GitHub with an initial README
Have a different error?
Paste any error message into the Error Translator to get an instant explanation.
