Today, I encountered a problem fatal: refusing to merge unrelated histories while pulling the git repository to my local machine.
The error basically means the current project we are working is unrelated to the repository that we are pulling. This usually happens when:
- We already have a git project in your local machine.
- We created a repository in remote like GitHub, Bitbucket, GitLab, and so on.
- Then you try to pull a repository in your local project.
Let’s fix fatal: refusing to merge unrelated histories
The error can be resolved when you append a parameter
--allow-unrelated-histories. Example is below.
Let’s say your remote branch is master then:
git pull origin master --allow-unrelated-histories
The problem we were facing is successfully resolved with the help of