fatal: refusing to merge unrelated histories

When you already have some thing in your git repo for example you created a git repo on github with readme file and then tried to push your local code first time to that github repo.
So github repo already has a commit, it will force you to first pull it to your local code before pushing your local code up.

When you issue a pull request it comes with “fatal: refusing to merge unrelated histories”

So before pushing your code to git, first pull it with allowing unrelated history, i.e issue the pull request with –allow-unrelated-histories

$ git pull origin master --allow-unrelated-histories

3 thoughts on “fatal: refusing to merge unrelated histories

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s