{"id":5000,"date":"2020-05-15T13:33:23","date_gmt":"2020-05-15T05:33:23","guid":{"rendered":"https:\/\/www.xttblog.com\/?p=5000"},"modified":"2020-05-15T13:33:23","modified_gmt":"2020-05-15T05:33:23","slug":"%e4%bf%ae%e5%a4%8d-fatal-refusing-to-merge-unrelated-histories-%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=5000","title":{"rendered":"\u4fee\u590d fatal: refusing to merge unrelated histories \u95ee\u9898"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u6700\u8fd1\u5728\u63d0\u4ea4\u4e00\u4e2a\u65b0\u9879\u76ee\u65f6\uff0c\u9047\u5230\u4e86 fatal: refusing to merge unrelated histories \u95ee\u9898\uff0c\u5728\u8fd9\u91cc\u505a\u4e00\u4e2a\u7b14\u8bb0\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u8fd1\u4e00\u53f0\u4ee3\u7801\u670d\u52a1\u5668\u5230\u671f\u4e86\uff0c\u521a\u597d\u6709\u4e00\u4e2a\u65b0\u9879\u76ee\uff0c\u9700\u8981\u63d0\u4ea4\uff0c\u9700\u8981\u8fc1\u79fb\u3002\u5728\u63d0\u4ea4\u4e00\u4e2a\u65f6\uff0c\u9047\u5230\u4e86 fatal: refusing to merge unrelated histories \u95ee\u9898\uff0c\u5728\u8fd9\u91cc\u505a\u4e00\u4e2a\u7b14\u8bb0\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\uff0c\u6211\u5728\u6253\u67b6\u597d\u7684\u4ee3\u7801\u670d\u52a1\u5668\u4e0a\uff0c\u4f7f\u7528 gitlab \u521d\u59cb\u5316\u4e86\u4e00\u4e2a\u9879\u76ee\uff0c\u5e76\u63d0\u4ea4\u4e86 readme.md\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\uff0c\u6211\u5728\u672c\u5730\u7684\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u6267\u884c\u4e86 git init\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u7740\u6267\u884c\uff0cgit commit -m &#8216;first commit&#8217;\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u518d\u7136\u540e\u5c31\u6309\u90e8\u5c31\u73ed\u7684\u5173\u8054\u9879\u76ee\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git remote add origin \u6211\u7684\u8fdc\u7a0b\u5e93\u5730\u5740\n\n# \u4e3e\u4f8b\uff1a\ngit remote add origin https:\/\/github.com\/xxxx\/codedq.git<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5173\u8054\u4e4b\u540e\uff0c\u8fdb\u884c\u4ee3\u7801 pull \u5408\u5e76\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git pull --rebase origin master<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u540e\uff0c\u4f7f\u7528 git push \u628a\u672c\u5730\u5e93\u7684\u5185\u5bb9\u63a8\u9001\u5230\u8fdc\u7a0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git push -u origin master<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u539f\u672c\u4ee5\u4e3a\u8fd9\u6837\u5c31 ok \u4e86\uff0c\u8c01\u77e5\u9053\uff0c\u62a5\u9519\u4e86\u3002fatal: refusing to merge unrelated histories\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7531\u4e8e\u8fd9\u662f\u4e00\u4e2a\u521d\u59cb\u5316\u9879\u76ee\uff0c\u6240\u4ee5\u6211\u5c31\u91c7\u7528\u5f3a\u5236\u63a8\u9001\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git push -f origin master<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\uff0c\u53c8\u5931\u8d25\u4e86\uff0c\u63d0\u793a\u6211\u6743\u9650\u4e0d\u8db3\u3002\u6211\u5229\u7528\u7ba1\u7406\u5458\u8d26\u53f7\u7ed9\u6211\u5206\u914d\u7684\u6743\u9650\u592a\u5c0f\u4e86\uff0c\u9650\u5236\u4e86\u5f3a\u5236\u63a8\u9001\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0d\u5f97\u5df2\uff0c\u6211\u53ea\u80fd\u4f7f\u7528 allow-unrelated-histories \u53c2\u6570\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git pull origin master --allow-unrelated-histories<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6267\u884c\u4e0a\u9762\u7684\u547d\u4ee4\u540e\uff0c\u518d\u6267\u884c git push\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git push -u origin master<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7ed9\u5927\u5bb6\u8bf4\u4e00\u4e0b\uff0c\u9650\u5236 git push -f \u662f\u5b8c\u5168\u5408\u7406\u7684\u3002\u5927\u5bb6\u4e00\u5b9a\u8981\u6ce8\u610f\u8fd9\u4e2a\u5371\u9669\u547d\u4ee4\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=5000\">\u4fee\u590d fatal: refusing to merge unrelated histories \u95ee\u9898<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u63d0\u4ea4\u4e00\u4e2a\u65b0\u9879\u76ee\u65f6\uff0c\u9047\u5230\u4e86 fatal: refusing to merge unrelated hist [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1438,1460,1639,645,1437],"class_list":["post-5000","post","type-post","status-publish","format-standard","hentry","category-yyzt","tag-git","tag-git-","tag-gitalk","tag-gitbook","tag-github"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5000"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5000\/revisions"}],"predecessor-version":[{"id":5001,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5000\/revisions\/5001"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}