所以我有一个存储库A。我想将所做的所有更改(和历史记录)推送到另一个存储库B。 所以,这就是我所做的:
git clone [A URL]
cd A // now i'm in the A directory (just to be clear)
gi remote add TeamRepo [B URL] // adds the B repository as a remote
git push TeamRepo master // tries to push the changes to B repository.
After last command, i have this error: fatal: refusing to merge unrelated histories
Can anyone help me with this? I found some kind of related articles, but they did not help me at all
当两个不相关的项目合并时(即不知道彼此的存在并且提交历史不匹配的项目),就会发生“致命的:拒绝合并无关的历史” Git错误。
您已经创建了一个新的存储库(TeamRepo),向其中添加了一些提交,现在您正尝试从已经具有自己的提交的远程存储库中拉入/推送。 Git在这种情况下也会抛出错误,因为它不知道两个项目之间的关系。
Solution: You can use
--allow-unrelated-histories
to force the push to happen. Documentation