{"id":21190,"date":"2024-11-19T16:34:56","date_gmt":"2024-11-19T08:34:56","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21190\/"},"modified":"2024-11-19T16:34:56","modified_gmt":"2024-11-19T08:34:56","slug":"git%e5%91%bd%e4%bb%a4%e8%a1%8c%e6%80%8e%e4%b9%88%e6%89%93%e5%bc%80","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21190\/","title":{"rendered":"git\u547d\u4ee4\u884c\u600e\u4e48\u6253\u5f00"},"content":{"rendered":"<blockquote><p>\n  \u4f7f\u7528 git \u547d\u4ee4\u884c\u9700\u8981\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u6253\u5f00\u7ec8\u7aef\u3002\u5bfc\u822a\u5230\u9879\u76ee\u76ee\u5f55\u3002\u521d\u59cb\u5316 git \u5b58\u50a8\u5e93\u3002\u68c0\u67e5 git \u72b6\u6001\u3002\u6dfb\u52a0\u548c\u63d0\u4ea4\u66f4\u6539\u3002\u914d\u7f6e\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u3002\u53ef\u9009\uff1a\u63a8\u9001\u5230\u8fdc\u7a0b\u5b58\u50a8\u5e93\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/09\/2024040911032548546.jpg\" class=\"aligncenter\" title=\"git\u547d\u4ee4\u884c\u600e\u4e48\u6253\u5f00\u63d2\u56fe\" alt=\"git\u547d\u4ee4\u884c\u600e\u4e48\u6253\u5f00\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4f7f\u7528 Git \u547d\u4ee4\u884c<\/strong><\/p>\n<p>\u8981\u901a\u8fc7\u547d\u4ee4\u884c\u6253\u5f00 Git\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<p><strong>1. \u6253\u5f00\u7ec8\u7aef<\/strong><\/p>\n<ul>\n<li>\u5bf9\u4e8e Mac \u7528\u6237\uff1a\u5728 Spotlight \u641c\u7d22\u4e2d\u8f93\u5165\u201c\u7ec8\u7aef\u201d\uff0c\u7136\u540e\u6309 Enter\u3002<\/li>\n<li>\u5bf9\u4e8e Windows \u7528\u6237\uff1a\u6309 Windows \u952e + R\uff0c\u8f93\u5165\u201ccmd\u201d\uff0c\u7136\u540e\u6309 Enter\u3002<\/li>\n<\/ul>\n<p><strong>2. \u5bfc\u822a\u5230\u60a8\u7684\u9879\u76ee\u76ee\u5f55<\/strong><\/p>\n<p>\u4f7f\u7528 cd \u547d\u4ee4\u5bfc\u822a\u5230\u60a8\u60f3\u8981\u4f7f\u7528 Git \u7684\u9879\u76ee\u76ee\u5f55\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>cd \/path\/to\/my_project<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u521d\u59cb\u5316 Git \u5b58\u50a8\u5e93<\/strong><\/p>\n<p>\u5982\u679c\u76ee\u5f55\u4e2d\u6ca1\u6709\u73b0\u6709\u7684 Git \u5b58\u50a8\u5e93\uff0c\u8bf7\u4f7f\u7528  init \u547d\u4ee4\u5bf9\u5176\u8fdb\u884c\u521d\u59cb\u5316\uff1a<\/p>\n<pre>git init<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u68c0\u67e5 Git \u72b6\u6001<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u5f53\u524d Git \u72b6\u6001\uff0c\u8bf7\u4f7f\u7528 git status \u547d\u4ee4\uff1a<\/p>\n<pre>git status<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u6dfb\u52a0\u548c\u63d0\u4ea4\u66f4\u6539<\/strong><\/p>\n<p>\u8981\u5c06\u66f4\u6539\u6dfb\u52a0\u5230\u6682\u5b58\u533a\u57df\uff0c\u8bf7\u4f7f\u7528 git add \u547d\u4ee4\u3002\u4f8b\u5982\uff0c\u8981\u6dfb\u52a0\u6240\u6709\u66f4\u6539\uff0c\u8bf7\u4f7f\u7528\uff1a<\/p>\n<pre>git add .<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u4f7f\u7528 git commit \u547d\u4ee4\u63d0\u4ea4\u66f4\u6539\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e2a\u63d0\u4ea4\u6d88\u606f\uff1a<\/p>\n<pre>git commit -m \"\u63d0\u4ea4\u6d88\u606f\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u914d\u7f6e\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6<\/strong><\/p>\n<p>\u4e3a\u4e86\u6307\u793a\u662f\u8c01\u63d0\u4ea4\u4e86\u66f4\u6539\uff0c\u8bf7\u4f7f\u7528 git config \u547d\u4ee4\u914d\u7f6e\u60a8\u7684\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\uff1a<\/p>\n<pre>git config --global user.name \"\u60a8\u7684\u59d3\u540d\"\ngit config --global user.email \"\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>7. \u63a8\u9001\u5230\u8fdc\u7a0b\u5b58\u50a8\u5e93\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<p>\u5982\u679c\u5c06\u66f4\u6539\u63a8\u9001\u5230\u8fdc\u7a0b\u5b58\u50a8\u5e93\uff0c\u8bf7\u4f7f\u7528 git push \u547d\u4ee4\uff1a<\/p>\n<pre>git push origin master<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d origin \u662f\u8fdc\u7a0b\u5b58\u50a8\u5e93\u7684\u540d\u79f0\uff0cmaster \u662f\u60a8\u8981\u63a8\u9001\u5230\u5b83\u7684\u5206\u652f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u547d\u4ee4\u884c\u600e\u4e48\u6253\u5f00\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>\u4f7f\u7528 git \u547d\u4ee4\u884c\u9700\u8981\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u6253\u5f00\u7ec8\u7aef\u3002\u5bfc\u822a\u5230\u9879\u76ee\u76ee\u5f55\u3002\u521d\u59cb\u5316 git \u5b58\u50a8\u5e93\u3002\u68c0\u67e5 git \u72b6\u6001\u3002\u6dfb\u52a0\u548c\u63d0\u4ea4\u66f4\u6539\u3002\u914d\u7f6e\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u3002\u53ef\u9009\uff1a\u63a8\u9001\u5230\u8fdc\u7a0b\u5b58\u50a8\u5e93\u3002 \u4f7f\u7528 Git \u547d\u4ee4\u884c \u8981\u901a\u8fc7\u547d\u4ee4\u884c\u6253\u5f00 Git\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a 1. \u6253\u5f00\u7ec8\u7aef \u5bf9\u4e8e Mac \u7528\u6237\uff1a\u5728 Spotlight \u641c\u7d22\u4e2d\u8f93\u5165\u201c\u7ec8\u7aef\u201d\uff0c\u7136\u540e\u6309 Enter\u3002 \u5bf9\u4e8e Windows \u7528\u6237\uff1a\u6309 Windows \u952e + R\uff0c\u8f93\u5165\u201ccmd\u201d\uff0c\u7136\u540e\u6309 Enter\u3002 2. \u5bfc\u822a\u5230\u60a8\u7684\u9879\u76ee\u76ee\u5f55 \u4f7f\u7528 cd \u547d\u4ee4\u5bfc\u822a\u5230\u60a8\u60f3\u8981\u4f7f\u7528 Git \u7684\u9879\u76ee\u76ee\u5f55\u3002\u4f8b\u5982\uff1a cd \/path\/to\/my_project \u767b\u5f55\u540e\u590d\u5236 3. \u521d\u59cb\u5316 Git \u5b58\u50a8\u5e93 \u5982\u679c\u76ee\u5f55\u4e2d\u6ca1\u6709\u73b0\u6709\u7684 Git \u5b58\u50a8\u5e93\uff0c\u8bf7\u4f7f\u7528 init \u547d\u4ee4\u5bf9\u5176\u8fdb\u884c\u521d\u59cb\u5316\uff1a git init \u767b\u5f55\u540e\u590d\u5236 4. \u68c0\u67e5 Git \u72b6\u6001 \u8981\u67e5\u770b\u5f53\u524d [&hellip;]<\/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-21190","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21190","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=21190"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21190\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}