How to deal with "refusing to merge unrelated histories" error #22075
-
Short version of my question : For years, I have been using a simple, single one-branch, one-contributor public online Github repo. A few days ago my computer died suddenly and I bought a new one. Now Github refuses to connect the local repo Long version of my question : here is the exact sequence of commands that I did in my new computer : Step 1 : Download git, use All the following command were executed in my new local repo’s main directory Step 2 : Step 3 : Do a Step 4 : Do the first commit : Step 5 : Do Step 6 :
Step 7 : Do as I’m told, and type :
Step 8 : Do as I’m told, and type :
Step 9 : Do as I’m told, and type :
Step 10 : Try
Step 11 : Try
|
Beta Was this translation helpful? Give feedback.
Replies: 19 comments 2 replies
-
If you just start a new repository, the history will be completely different than GitHub knows it. Use
and just make commits on top of that. Then push. |
Beta Was this translation helpful? Give feedback.
-
I ended in the same situation after a series of mishapps. Have a look at this thread : I just did a
and it was fixed! |
Beta Was this translation helpful? Give feedback.
-
I was also facing the same problem. But I realised I was trying to push my one git project material on other remote git project. Solution: Clone the fresh project again and this time make sure cloning link is starting from ssh if you have added the SSH key and https:// if you have added the puttyKey. |
Beta Was this translation helpful? Give feedback.
-
Thanks, worked fine for me. |
Beta Was this translation helpful? Give feedback.
-
I am in a similar situation where I am getting the same messages. Probably I just need to do the
But I wish I knew what situations where I should not. Obviously we get the message because there might sometimes be a good reason to not do the allow. I got into my situation because I did not know what I was doing and did something I should not have. |
Beta Was this translation helpful? Give feedback.
-
I am receiving the message saying “there is no tracking information for the current branch” |
Beta Was this translation helpful? Give feedback.
-
Help for me. thanks! |
Beta Was this translation helpful? Give feedback.
-
Thank, you for you help. |
Beta Was this translation helpful? Give feedback.
-
worked |
Beta Was this translation helpful? Give feedback.
-
This is great, thank you very much! |
Beta Was this translation helpful? Give feedback.
-
This command is a dangerous one. “git pull --allow-unrelated-histories” it has messed up my whole codebase i dont know what happened and am not in a position to recover from it |
Beta Was this translation helpful? Give feedback.
-
It’s worked for me. |
Beta Was this translation helpful? Give feedback.
-
Thanks, It works for me. |
Beta Was this translation helpful? Give feedback.
-
Works for me too ! thank you :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
Thanks, Woked superbly for me as well. git pull <remote> <branch> --allow-unrelated-histories |
Beta Was this translation helpful? Give feedback.
-
Worked like a charm |
Beta Was this translation helpful? Give feedback.
-
I got this error, but found another cause: somehow, the ssh url of another project got into this one’s .git/config file. So before running this to accept ‘unrelated histories’, you may want to confirm you have the right repo’s url. I fixed mine and it started working again. :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
Probably because you did a |
Beta Was this translation helpful? Give feedback.
-
I tried the --allow-unrelated-histories and got this: warning: Cannot merge binary files: biostats.final.3.2.pdf (HEAD vs. 93379526ed908abd4f58b2010eb055aace5df522) warning: Cannot merge binary files: .DS_Store (HEAD vs. 93379526ed908abd4f58b2010eb055aace5df522) Auto-merging <file name here> CONFLICT (add/add): Merge conflict in <file name here> Auto-merging <file name here> CONFLICT (add/add): Merge conflict in <file name here> Auto-merging <file name here> CONFLICT (add/add): Merge conflict in <file name here> Auto-merging <file name here> CONFLICT (add/add): Merge conflict in <file name here> Auto-merging <file name here> Automatic merge failed; fix conflicts and then commit the result. |
Beta Was this translation helpful? Give feedback.
I ended in the same situation after a series of mishapps. Have a look at this thread : I just did a
and it was fixed!