{"id":19598,"date":"2024-11-19T11:49:40","date_gmt":"2024-11-19T03:49:40","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19598\/"},"modified":"2024-11-19T11:49:40","modified_gmt":"2024-11-19T03:49:40","slug":"%e6%80%8e%e4%b9%88%e6%8a%8a%e4%bb%a3%e7%a0%81push%e5%88%b0gitlab%e5%88%86%e6%94%af%e4%b8%8a%ef%bc%88%e6%ad%a5%e9%aa%a4%e6%b5%85%e6%9e%90%ef%bc%89","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19598\/","title":{"rendered":"\u600e\u4e48\u628a\u4ee3\u7801push\u5230gitlab\u5206\u652f\u4e0a\uff08\u6b65\u9aa4\u6d45\u6790\uff09"},"content":{"rendered":"<p>\u5728gitlab\u4e2d\u64cd\u4f5c\u4ee3\u7801\u7ba1\u7406\uff0c\u6700\u57fa\u672c\u7684\u6b65\u9aa4\u5c31\u662f\u5c06\u672c\u5730\u4ee3\u7801\u63a8\u9001\u5230gitlab\u4ed3\u5e93\u7684\u5206\u652f\u4e0a\u3002\u4e0b\u9762\u662f\u5c06\u4ee3\u7801push\u5230\u4e00\u4e2a\u5df2\u6709\u7684gitlab\u5206\u652f\u4e0a\u7684\u57fa\u672c\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u68c0\u67e5\u60a8\u7684\u672c\u5730Git\u4ed3\u5e93\u662f\u5426\u4e0eGitLab\u670d\u52a1\u5668\u4e0a\u7684\u4ed3\u5e93\u540c\u6b65\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Git bash \/\u7ec8\u7aef\u7684git fetch\u547d\u4ee4\u6765\u5c06\u8fdc\u7a0b\u5206\u652f\u7684\u6700\u65b0\u4ee3\u7801\u4e0b\u8f7d\u5230\u672c\u5730\u5206\u652f\u3002<\/li>\n<li>\u63a5\u4e0b\u6765\uff0c\u60a8\u9700\u8981\u5728\u672c\u5730\u521b\u5efa\u548c\u63d0\u4ea4\u65b0\u7684\u66f4\u6539\u6216\u5df2\u7ecf\u4fee\u6539\u7684\u4ee3\u7801\u3002\u4f7f\u7528git add\u548cgit commit\u547d\u4ee4\u5c06\u66f4\u6539\u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93\u3002<\/li>\n<li>\n<p>\u6700\u91cd\u8981\u7684\u6b65\u9aa4\u662f\u5c06\u5b83\u4eec\u63a8\u9001\u5230GitLab\u4ed3\u5e93\u7684\u5206\u652f\u4e0a\u3002\u4f7f\u7528git push\u547d\u4ee4\u5c06\u672c\u5730\u4ee3\u7801push\u5230GitLab\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5206\u652f\u4e0a\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u4f8b\u5982\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u672c\u5730\u4ee3\u7801\u63a8\u9001\u5230GitLab\u7684\u5206\u652f\uff1a<\/p>\n<pre>git&nbsp;push&nbsp;origin&nbsp;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6ce8\u610f\uff0c\u5728\u6b64\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5148\u5c06\u5206\u652f\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5206\u652f\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/p>\n<pre>git&nbsp;push&nbsp;--set-upstream&nbsp;origin&nbsp;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u6700\u540e\uff0c\u5982\u679c\u60a8\u906d\u9047\u4efb\u4f55\u51b2\u7a81\uff0c\u9700\u8981\u89e3\u51b3\u6b64\u51b2\u7a81\uff0c\u8bf7\u5728\u672c\u5730\u4f7f\u7528git pull\u547d\u4ee4\uff0c\u89e3\u51b3\u51b2\u7a81\u540e\u7ee7\u7eed\u63a8\u9001\u66f4\u6539\u3002<\/li>\n<\/ol>\n<p>\u5728\u672c\u5730\u4ee3\u7801\u7f16\u8f91\u5668\u4e2d\u8fdb\u884cgit push\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u770b\u5230\u4ee5\u4e0b\u547d\u4ee4\u884c\u63d0\u793a\uff1a<\/p>\n<blockquote><p>\n  fatal: The current branch has no upstream branch.\n<\/p><\/blockquote>\n<p>\u8fd9\u610f\u5473\u7740\u672c\u5730\u4ee3\u7801\u4ed3\u5e93\u7684\u6307\u5b9a\u5206\u652f\u4e0d\u5b58\u5728\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u60a8\u9700\u8981\u4f7f\u7528git push &#8211;set-upstream\u547d\u4ee4\u624b\u52a8\u5c06\u672c\u5730\u5206\u652f\u63a8\u9001\u5230\u8fdc\u7a0b\u5206\u652f\u3002\u6ce8\u610f\uff0c&#8211;set-upstream\u9009\u9879\u53ea\u9700\u8981\u7b2c\u4e00\u6b21\u63a8\u9001\u5206\u652f\u3002\u4e4b\u540e\uff0c\u4f7f\u7528git push\u547d\u4ee4\u5373\u53ef\u3002<\/p>\n<p>\u603b\u4e4b\uff0c\u5c06\u4ee3\u7801\u63a8\u9001\u5230GitLab\u5206\u652f\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5171\u4eab\u4ee3\u7801\u5e76\u4e0e\u56e2\u961f\u6210\u5458\u534f\u4f5c\u3002\u9075\u5faa\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u5f88\u5bb9\u6613\u5c06\u4ee3\u7801push\u5230\u60a8\u7684GitLab\u5206\u652f\u4e0a\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u628a\u4ee3\u7801push\u5230gitlab\u5206\u652f\u4e0a\uff08\u6b65\u9aa4\u6d45\u6790\uff09\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728gitlab\u4e2d\u64cd\u4f5c\u4ee3\u7801\u7ba1\u7406\uff0c\u6700\u57fa\u672c\u7684\u6b65\u9aa4\u5c31\u662f\u5c06\u672c\u5730\u4ee3\u7801\u63a8\u9001\u5230gitlab\u4ed3\u5e93\u7684\u5206\u652f\u4e0a\u3002\u4e0b\u9762\u662f\u5c06\u4ee3\u7801push\u5230\u4e00\u4e2a\u5df2\u6709\u7684gitlab\u5206\u652f\u4e0a\u7684\u57fa\u672c\u6b65\u9aa4\uff1a \u9996\u5148\uff0c\u68c0\u67e5\u60a8\u7684\u672c\u5730Git\u4ed3\u5e93\u662f\u5426\u4e0eGitLab\u670d\u52a1\u5668\u4e0a\u7684\u4ed3\u5e93\u540c\u6b65\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Git bash \/\u7ec8\u7aef\u7684git fetch\u547d\u4ee4\u6765\u5c06\u8fdc\u7a0b\u5206\u652f\u7684\u6700\u65b0\u4ee3\u7801\u4e0b\u8f7d\u5230\u672c\u5730\u5206\u652f\u3002 \u63a5\u4e0b\u6765\uff0c\u60a8\u9700\u8981\u5728\u672c\u5730\u521b\u5efa\u548c\u63d0\u4ea4\u65b0\u7684\u66f4\u6539\u6216\u5df2\u7ecf\u4fee\u6539\u7684\u4ee3\u7801\u3002\u4f7f\u7528git add\u548cgit commit\u547d\u4ee4\u5c06\u66f4\u6539\u63d0\u4ea4\u5230\u672c\u5730\u4ed3\u5e93\u3002 \u6700\u91cd\u8981\u7684\u6b65\u9aa4\u662f\u5c06\u5b83\u4eec\u63a8\u9001\u5230GitLab\u4ed3\u5e93\u7684\u5206\u652f\u4e0a\u3002\u4f7f\u7528git push\u547d\u4ee4\u5c06\u672c\u5730\u4ee3\u7801push\u5230GitLab\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5206\u652f\u4e0a\u3002 \u4f8b\u5982\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u672c\u5730\u4ee3\u7801\u63a8\u9001\u5230GitLab\u7684\u5206\u652f\uff1a git&nbsp;push&nbsp;origin&nbsp; \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\uff0c\u5728\u6b64\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5148\u5c06\u5206\u652f\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5206\u652f\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff1a git&nbsp;push&nbsp;&#8211;set-upstream&nbsp;origin&nbsp; \u767b\u5f55\u540e\u590d\u5236 \u6700\u540e\uff0c\u5982\u679c\u60a8\u906d\u9047\u4efb\u4f55\u51b2\u7a81\uff0c\u9700\u8981\u89e3\u51b3\u6b64\u51b2\u7a81\uff0c\u8bf7\u5728\u672c\u5730\u4f7f\u7528git pull\u547d\u4ee4\uff0c\u89e3\u51b3\u51b2\u7a81\u540e\u7ee7\u7eed\u63a8\u9001\u66f4\u6539\u3002 \u5728\u672c\u5730\u4ee3\u7801\u7f16\u8f91\u5668\u4e2d\u8fdb\u884cgit push\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u770b\u5230\u4ee5\u4e0b\u547d\u4ee4\u884c\u63d0\u793a\uff1a fatal: The current branch has no upstream branch. \u8fd9\u610f\u5473\u7740\u672c\u5730\u4ee3\u7801\u4ed3\u5e93\u7684\u6307\u5b9a\u5206\u652f\u4e0d\u5b58\u5728\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u60a8\u9700\u8981\u4f7f\u7528git push &#8211;set-upstream\u547d\u4ee4\u624b\u52a8\u5c06\u672c\u5730\u5206\u652f\u63a8\u9001\u5230\u8fdc\u7a0b\u5206\u652f\u3002\u6ce8\u610f\uff0c&#8211;set-upstream\u9009\u9879\u53ea\u9700\u8981\u7b2c\u4e00\u6b21\u63a8\u9001\u5206\u652f\u3002\u4e4b\u540e\uff0c\u4f7f\u7528git push\u547d\u4ee4\u5373\u53ef\u3002 \u603b\u4e4b\uff0c\u5c06\u4ee3\u7801\u63a8\u9001\u5230GitLab\u5206\u652f\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5171\u4eab\u4ee3\u7801\u5e76\u4e0e\u56e2\u961f\u6210\u5458\u534f\u4f5c\u3002\u9075\u5faa\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u5f88\u5bb9\u6613\u5c06\u4ee3\u7801push\u5230\u60a8\u7684GitLab\u5206\u652f\u4e0a\u3002 \u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u628a\u4ee3\u7801push\u5230gitlab\u5206\u652f\u4e0a\uff08\u6b65\u9aa4\u6d45\u6790\uff09\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19598","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19598"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19598\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}