Adding a new git remote to an existing project

Today I had a project that I already had in git and I had an existing remote I had already pushed to. Now I wanted to add github as well so I added the repo on github and initialized the repo with a README.mf and a LICENSE file. After adding the remote to the local repo and attempting to pull from it I got the following error:

fatal: refusing to merge unrelated histories

Apparent the way the merge command work has been changed in git v. 2.9 to make sure you do not mix histories by accident. To actually do this use the –allow-unrelated-histories switch. Solution was to add that to my pull command I all was good.

git pull origin master --allow-unrelated-histories

Now I had the README.mf and LICENSE files from github in my local repo so I could edit I push back up. Easy!

Published by

lekkim

Positive, competent, out-spoken, frank and customer focused architect and developer with a strong foundation in web, cloud and product development. I'm a strong advocate for API first and cloud based solutions and development. I have a knack for being able to communicate and present technically complicated matters in conference, customer and training settings. I've previously acted as team member and leader in a product organisation.